Peters Flexible RenAmiNg Kit (PFrank) Forum Index Peters Flexible RenAmiNg Kit (PFrank)
Support and Discussion Site for the PFrank File/Folder Renaming Tool (***NEW HOME PAGE*** "http://pfrank.atwebpages.com")
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get name from one file and put it on another

 
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> General Support
View previous topic :: View next topic  
Author Message
martix



Joined: 20 Apr 2007
Posts: 17

PostPosted: Fri May 09, 2008 2:12 am    Post subject: Get name from one file and put it on another Reply with quote

How can I do that?
I want to take a string from one filetype and add it to the name of another one.
I basically want the search pattern to work on one type of file and the replace pattern on another.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Fri May 09, 2008 4:30 am    Post subject: Reply with quote

This might require a plugin.
I need more information.
Can you give some specific examples please.

Thanks,

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
martix



Joined: 20 Apr 2007
Posts: 17

PostPosted: Fri May 09, 2008 3:01 pm    Post subject: Reply with quote

Not that an example will could make things a lot clearer, but why not. Smile

The most useful thing would be take the name from a video file and apply it to its subtitle or vice versa...
Say "House MD 101 - Pilot.avi" and "House 1x01.srt"
Take name one and apply it to name two.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Fri May 09, 2008 4:26 pm    Post subject: Reply with quote

There is no general way to associate what are basically arbitrary name pairs. For the example, you could find the 2 files with the word House and 01 and map them to the same prefix but you would have to do that for every pair of names.

This is what I would do.
1)
Enable the 'general options' attribute for showing unchanged names.
2)
Run the scan on the main window. Just do something like search for 'a' and replace with 'a'. This will result in the preview window showing all the existing filenames. (in the upcoming version 2.19 you won't have to put anything in the custom list in order to get a preview of all currenlty existing names).
3)
Right click on the preview window and pick the option to 'copy full pathnames to the clipboard' .
Copy the clipboard data to a filename where you can manually edit to create pairs of filenames in preparation for importing the file back to PFrank.

OR

Use the export option to export the preview columns to a csv file (you can first disable the display of all the columns you don't want). Edit the csv file to create pairs of filenames
4)
Import the file to PFrank and rename.

This procedure should be much easier than using the mouse to rename the files in the explorer window.

I'll just mention that there is a grouping feature where if you already have filenames with the same prefix, you can insert metadata from one of the file types and insert that data into all the filenames which have the same prefix. e.g. if you have the filenames:

House 1x01.avi
House 1x01.srt

and the avi file has metadata with say the video width and height, then you could insert the info into both the avi and srt file resulting in something like:

House 1x01 (350x650).avi
House 1x01 (350x650).srt

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
martix



Joined: 20 Apr 2007
Posts: 17

PostPosted: Fri May 09, 2008 9:38 pm    Post subject: Re: Get name from one file and put it on another Reply with quote

I see...
Getting a systematic summary should make things a bit easier, but I'm still gonna ask. Smile

martix wrote:
I basically want the search pattern to work on one type of file and the replace pattern on another. - Like use a regex to match the source, then use a regex to match target and replace from the source.

Is this functionality very hard to implement? I guess it will need work on the regex engine itself...
Or can it be done with user defined commands(python n' stuff)? Smile
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat May 10, 2008 3:21 pm    Post subject: Reply with quote

This can be done with a User-Defined command (plugin).

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
martix



Joined: 20 Apr 2007
Posts: 17

PostPosted: Sun May 11, 2008 4:49 pm    Post subject: Reply with quote

So... any guidelines? I am completely new to Python...
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sun May 11, 2008 9:49 pm    Post subject: Reply with quote

OK - I'll present an algorithm. If you think it's worth proceeding I can give you some sample python statements that should help.

0)
you'll have to define a list of regex pairs for each name that you want to search for as the source and each name that you want to replace (with the source)
potentialy this list could be as long as every name that has to be renamed. THis is why I question other use of a plugin since it would probably be less work to create an excel spreadsheet with a list of all old/new name pairs and import it for renaming.
1)
every plugin has a function called initforscan(). this is called by PFrank after a list of all candidate names have been scanned into a list. The list name is configurator.scanlist
2)
when initforscan is called, you can scan the entire list looking for the names that match regex1 and regex2. ALl the newnames can be calculated a this point and saved into a list with oldname/newname pairs.
3)
All the work is done at this point, YOu just have to get the names into the PFrank engine.
4)
After the initforscan() ic called, PFrank will itself go through the scanlist. It will pass you one name at a time for renaming using the fixnames() method. When this method is called you would just examine the name that was passed in and return the new name that you calclulated for that entry previously.

That's all there is to it. Step 1 is the most complicated part but not that bad.
Step 0 is the most work in my opinion. Unless I'm missing something, I think you would have to define 2 regex's for each name that you want to change in which case you might as well just define the old/new name pairs in an import file.

If you want to go ahead with a python plugin then let me know and I can give you some sample code.

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> General Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own Video Sharing Site

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com