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 

[New help needed !!!] : plugin, mediainfo and renaming

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Fri Aug 22, 2008 11:53 pm    Post subject: [New help needed !!!] : plugin, mediainfo and renaming Reply with quote

ok,

sorry but totally lost here...

How can I add the mediainfo plugin ?

I did :

Code:
Or just rename this file as PFrankUser.py and
move it to your PFrank install folder if you don't want any other plugins.


but Pfrank gave me this :

Code:
Error: Cannot Access UserRenamerList in 'PFrankUser.py' User Defined Command File (Plugin) File.


about UserRenamerlist :

Code:
2)
Insert a line corresponding to your command in the UserRenamerList near the
end of this file (Don't forget the parentheses!).


Question Question Question Question Question Question

Totally lost, I said Sad

Thanks

PS : then I'll ask how to properly rename if I cant


Last edited by hubert on Fri Jun 26, 2009 2:04 am; edited 1 time in total
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat Aug 23, 2008 1:12 pm    Post subject: Reply with quote

I found a bug in the plugin. Give me a day or so to fix it as. Thanks very much for pointing this out.

You might not need a plugin as it is only required if the pre-defined commands of PFrank can't extract the data you want. Even then you would probably have to code the plugin yourself as the example plugin is a template (i.e. so far only insertion of video aspect ratio is provided; but coding of other insertions is straight forward).
Did you try the pre-defined commands for insertion of media data (video, music, etc?).
What kind of media data are you looking for and for what type of files.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Sat Aug 23, 2008 2:55 pm    Post subject: Reply with quote

HI, thanks for your quick answer...

Have a digital camera, and the only right date is the "encoded date" given by mediainfo. All others are wrong (modified created, ...). So I need this one to rename my movies...

Thanks again.

hubert
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat Aug 23, 2008 11:40 pm    Post subject: Reply with quote

Hi Hubert,

The updated plugin is at:

http://www3.telus.net/pfrank/PFrank_MediaMetaData_Plugin.py

Just rename this file to 'PFrankUser.py' as you did the other one and move to the install folder.

I added a command for extracting the 'encoded date'
You should see the command at th top of teh 'Predefined Command' pull down list. Just insert it into the creator list and press scan.

The processing by the plugin is totally dependent on the format of the 'date encoded line'. I assumed the format is as shown in the plugin example. If your output is different than expected by the line processing function for the 'encoded date' class, then the processing will have to be modified.

ONe warning: The plugin checks for vaid filename extensions. The acceptable extensions are declared in the following line:

self.mediaextensions = [ ".avi", ".mpg", ".mov", ".qt" ]

If your filenames have different extensions, then just add them to the above (and let me know so I can add them to my copy).

If you have any problems then please send me sample output from mediainfo when run it against some of your video files.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Sun Aug 24, 2008 10:29 am    Post subject: Reply with quote

hi sorry, but have more question. In the py file :

Code:
TO USE THIS COMMAND, YOU MUST INSTALL THE IMAGEINFO UTILITY (command line version) BEFOREHAND.  THEN IF
    NECESSARY MODIFY THE PATH TO 'ImageInfo' IN THE 'FIXNAMES' METHOD BELOW


I have installed mediainfo gui. Should I install the comand line version ? If yes, where should I write the path to mediainfo ?

Thanks.

hubert
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sun Aug 24, 2008 11:43 pm    Post subject: Reply with quote

Yes - you need to install the command line version.

Then make sure that the path to the imageinfo exe matches that specified in the plugin.
In the plugin file look for the line:

mediainfopath = os.path.join("C:\\Program Files\mediainfo", "mediainfo.exe")

and modify the "C:\\Program Files\mediainfo" part to match the path on your PC.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Thu Oct 09, 2008 6:43 pm    Post subject: Reply with quote

hi, long time not here, sorry, was away for a long time...

Ok, I come closer and closer Smile

no I have forbiden characters : " / \ :" I think it's : between the time given by mediainfo. But I can't replace these ":" in the routine, can I ? Or making a second string search ":" replacing with "_" for example....

strange i found this :

Code:
# remove ':' character since it is an invalid char in a file name
        time = time.replace(":", "")
        datetime = date + " " + time

thanks


Last edited by hubert on Fri Oct 10, 2008 3:12 am; edited 1 time in total
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Fri Oct 10, 2008 2:13 am    Post subject: Reply with quote

Hi Hubert,

Yes the time.replace statement should have replaced any ':' with nothing (i.e. it should have deleted the ':' ).

Not sure why it didnt work unless the output is not as expected. An expected output sample is given a few lines above above the time.replace statement:

"Encoded date : UTC 2007-12-03 06:14:09"

If the output does not look as above, then the code has to be modified.

But it is much easier to just add another line in the custom renamer (after row that has the custom command) that searches for ':' and replaces with nothing.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Fri Oct 10, 2008 3:12 am    Post subject: Reply with quote

Yep, agree with you "should have"...

the output is as you expected, I saw what mediainfo give :

Code:
Date d'encodage                  : UTC 2008-07-03 06:35:22


I already added a second line with ":" and nothing, but the error is the same....

Now, maybe I cant use this soft Sad

what I did :
1) folder chosen
2) name filter : *.mp4
3) Search string .* replace "user insert encoded date before..
4)search string : replace nothing

same error :

Code:
the replace pattern specified by "*user - Insert Encoded Date(...)*" of Row1 contains illegal characters. A file name or folder name cannot contain any of the following characters. \ / : * ? < > |


Anyway, thanks a lot for your sooooooooo quick answer
Smile
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Fri Oct 10, 2008 5:59 am    Post subject: Reply with quote

Hi Hubert,

The error is not with the plugin. The error is complaining about the content of row 1 in the custom renamer. You probably have some characters in the search column. When you insert a command into a customer renaming row, then the search column must remain empty.

Delete the content of the search column of row 1. That should get rid of the error.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Fri Oct 10, 2008 10:40 pm    Post subject: Reply with quote

Omg , I can't explain better, like some said : "Better a good picture, rather than bad english" Smile



Same error. And when I put nothing in Row1, pfrank does nothing....

Does it work with your plugin ?

Thanks again...
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat Oct 11, 2008 3:25 am    Post subject: Reply with quote

Hi Hubert,

The diagram says it all.
You have to delete the 'SANYO' part (not the whole row)

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Sat Oct 11, 2008 4:31 am    Post subject: Reply with quote

Sorry, forgot to mention that I did blank the first search : does find nothing :



thanks again and agin Smile
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat Oct 11, 2008 5:36 am    Post subject: Reply with quote

Everything looks ok. Don't know why the data was not picked up by the plugin.
Would you please send me one of the smaller .mp4 files.
I'd like to try renaming it using the plugin.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Sat Oct 11, 2008 5:48 am    Post subject: Reply with quote

Done, thanks. Hoping that I didn't make any mistake with installing cmd mediainfo and customizing the plugin....

Don't work with avi files as well
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat Oct 11, 2008 6:44 am    Post subject: Reply with quote

Hi Hubert,

I tested the SANYO file you sent me with the latest version of the command-line version of mediainfo. the output from mediainfo is null for that file. It appears that the SANYO file has no media info in it.
What kind of output do you get with comand-line version of mediainfo?

I'm going to bed now; it's getting late.
Let me know what you find out.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Sat Oct 11, 2008 2:21 pm    Post subject: Reply with quote

Good morning Smile

ok with the gui and here is the result given by the cmd version

Code:
C:\Program Files\PFrank\mediainfo>MediaInfo.exe "C:\Users\hubert\Desktop\SANY0006
.MP4"
General
Complete name                    : C:\Users\hubert\Desktop\SANY0006.MP4
Format                           : MPEG-4
Format profile                   : Base Media / Version 2
Codec ID                         : mp42
File size                        : 352 KiB
Duration                         : 1s 0ms
Overall bit rate                 : 2 884 Kbps
Movie name/More                  : SANYO DIGITAL CAMERA C6
Encoded date                     : UTC 2008-10-11 01:57:30
Tagged date                      : UTC 2008-10-11 01:57:30
Origin                           : Digital Camera

Video
Format                           : MPEG-4 Visual
Format profile                   : Simple Streaming Video@L3
Format settings, BVOP            : Yes
Format settings, QPel            : No
Format settings, GMC             : No warppoints
Format settings, Matrix          : Default
Codec ID                         : 20
Duration                         : 1s 0ms
Bit rate mode                    : Variable
Bit rate                         : 639 Kbps
Nominal bit rate                 : 3 000 Kbps
Maximum bit rate                 : 6 000 Kbps
Width                            : 640 pixels
Height                           : 480 pixels
Display aspect ratio             : 4/3
Frame rate mode                  : Constant
Frame rate                       : 29.970 fps
Resolution                       : 24 bits
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.069
Stream size                      : 78.0 KiB (22%)
Language                         : English
Encoded date                     : UTC 2008-10-11 01:57:30
Tagged date                      : UTC 2008-10-11 01:57:30

Audio
Format                           : AAC
Format/Info                      : Advanced Audio Codec
Format version                   : Version 4
Format profile                   : LC
Format settings, SBR             : No
Codec ID                         : 40
Duration                         : 1s 0ms
Bit rate mode                    : Variable
Bit rate                         : 115 Kbps
Nominal bit rate                 : 128 Kbps
Maximum bit rate                 : 192 Kbps
Channel(s)                       : 2 channels
Channel positions                : L R
Sampling rate                    : 48.0 KHz
Resolution                       : 16 bits
Stream size                      : 14.1 KiB (4%)
Language                         : English
Encoded date                     : UTC 2008-10-11 01:57:30
Tagged date                      : UTC 2008-10-11 01:57:30
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat Oct 11, 2008 10:08 pm    Post subject: Reply with quote

HI Hubert,

OK - I found out that I was calling up the wrong mediainfo executable (it was an old version).
Once I fixed the path I found out the problem in the plugin.

In the plugin I had put in protection against processing invalid media files because the old version of mediainfo that I had would crash on them.

You need to change this line:

self.mediaextensions = [ ".avi", ".mpg", ".mov", ".qt" ]

to:

self.mediaextensions = [ ".avi", ".mpg", ".mov", ".qt", ".MP4" ]

Otherwise the plugin won't process your MP4 files.

That should do it!
Let me know if you have any other problems.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Sun Oct 12, 2008 5:18 am    Post subject: Reply with quote

Evil or Very Mad Twisted Evil Evil or Very Mad Twisted Evil

Sorry, all this work just for this ".MP4". I did add "*.mp4" (was case senstitiv Sad)

Very sorry.... Anyways, it works Very Happy Smile Very Happy !!!!!!

thanks

I just had to modify
Code:
time = time.replace(":", "-")
        datetime = date + "_" + time


So it looks like the other renaming photo program (picasa, acdsee, ...)

Bye and many thanks, the soft is great Very Happy

PS : I did insert command "del all prefix" and then add "encoded date"... there is a "_" left on the end of the prefix, not so bad, but still....

Wink

I had to add a row3 : annoying Very Happy
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sun Oct 12, 2008 5:55 am    Post subject: Reply with quote

Yes! Very Happy
Glad it worked out.

I've uploaded a new mediainfo plugin file to the plugin web page. The revised file includes the .mp4 extension and extensions are no longer case sensitive.

All the best,

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Sat Oct 25, 2008 2:36 am    Post subject: Reply with quote

Ok, here is my "chain"...

Maybe there is a more beautiful chain, but i have this "_" on the end of my prefix that I have to delete....

anyway, works like a charm, thanks again Peter Smile


Code:
Row: 1
   Search:
   Replace: '*Delete All Characters in*Prefix*'
Row: 2
   Search:
   Replace: '*(User) - Insert Encoded Date before *Prefix*'
Row: 3
   Search:  '([^\.]*?).{1,1}\.([^\.]*?)$'
   Replace: '\1.\2'
Back to top
View user's profile Send private message
hubert



Joined: 22 Aug 2008
Posts: 15

PostPosted: Fri Jun 26, 2009 2:03 am    Post subject: Reply with quote

Sorry Peter,

I'm under windows 7 RC now,

did the same way as above and have issue adding encoded date....

The Mediainfo CLI give this :

Code:

D:\Program Files\PFrank\mediainfo>MediaInfo.exe "D:\Photos\Archivé\2009\2009-06-22\SANY0001.MP4"
General
Complete name                    : D:\Photos\Archivé\2009\2009-06-22\SANY0001.MP4
Format                           : MPEG-4
Format profile                   : Base Media / Version 2
Codec ID                         : mp42
File size                        : 10.4 MiB
Duration                         : 27s 93ms
Overall bit rate                 : 3 212 Kbps
Movie name/More                  : SANYO DIGITAL CAMERA C6
Encoded date                     : UTC 2009-05-28 22:26:05
Tagged date                      : UTC 2009-05-28 22:26:05
Origin                           : Digital Camera


Pfrank give that :
Code:

Jun 25 2009 21:56:40    ***User Defined Command File (Plugin) Validation Summary

User Defined Command (Plugin) Loading Successful
       '(User) - Insert Aspect Ratio before '
       '(User) - Insert Encoded Date before '
2 Plugins Loaded into 'Pre-Defined Command' Selection


==========================================================================
Jun 25 2009 21:57:01    ***Scan Complete

'Custom' Replacement Summary:

Row: 1
   Search:
   Replace: '*Delete All Characters in*Prefix*'
Row: 2
   Search:
   Replace: '*(User) - Insert Encoded Date before *All*'
Row: 3
   Search:  '([^\.]*?).{1,1}\.([^\.]*?)$'
   Replace: '\1.\2'

WARNING - FIXED DUPLICATION(1): Duplicate New File:
    'D:\Photos\Archivé\2009\2009-06-22\.MP4'
 Will Be Created by Renaming the Following Files:
    'D:\Photos\Archivé\2009\2009-06-22\SANY0001.MP4'
(...)
    Current Folder:   'D:\Photos\Archivé\2009\2009-06-22'
    Name Filter (Unix Wildcard match for patterns):
   Types:      Files Only            Name Filter:      '*.MP4'
   Exclude Types:   Hidden, System
   Date Exclusion:   Disabled            Name Exclusion Filter:   None
   Min Name Length:   001   Max Name Length:  512   Min Path Length: 001   Max Path Length: 512
   Subfolder Levels:   512            Subfolder Filter:      '*'
                     Subfolder Exclusion Filter:   None
    TOTAL PROBLEMS:      1 (Duplication Fixed Warning)

Total Names to be Changed:         18
Total Names Scanned (after Filtering):      18


With the same .py file

thanks


Last edited by hubert on Sun Jun 28, 2009 4:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sun Jun 28, 2009 3:19 am    Post subject: Reply with quote

Hi,

I thought that maybe the latest version of mediainfo (0.7.17) had different output but I tried it on my Windows XP system and all was fine.

The problem might be related to Windows 7.

Unfortunately I don't ahve access to a windows 7 system.

The PFrankUser.py file can be run standalone if you download and install python from:

http://www.python.org/download/

If you install it and run the file using the IDLE tool that comes with the python download, you'll see a section at the end of the file where you can insert full paths of files to test. Then you can add or uncomment print statements (especially this one: '#print "media data is: ", mediadata
'
All you have to do is remove the leading #. If you use IDLE, just press F5 to run the file and see what is printed.

Sorry I can't do more.
Hope that helps.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Sun Jun 28, 2009 4:53 pm    Post subject: Reply with quote

strange pfrank's python script cannot find the file

Code:
Error 'File access not found
' detected for File: 'D:\SANY0001.MP4'
Oldname is:  D:\SANY0001.MP4
Newname is:  D:\SANY0001.MP4


But the file is there !!!

And the script is :

Code:
# this is a table of sample filenames for testing
  # Assume that the files are in the current folder.
  nameTable = [
      "D:\\SANY0001.MP4",     
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sun Jun 28, 2009 9:47 pm    Post subject: Reply with quote

Hi Hubert,

The nameTable entry is correct. It works on my XP system. the comment about the test file being in the current folder is not correct - the file in the name table is specified with a full path starting from the D drive.

If you created a file called SANY0006.MP4 and put it in your D drive and the script can't access it, then all I can think of is that this might be a permissions problem.

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



Joined: 22 Aug 2008
Posts: 15

PostPosted: Mon Jun 29, 2009 2:39 am    Post subject: Reply with quote

I'm very sorry Peter :

1. Tested permission : ok
2. the Mediainfo path was not good (don't know why I changed it with the edit function in Pfrank)
3. relaunched Pfrank with the edited file in python gui : works !

sorry, you were loosing your time cos of me Sad
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Mon Jun 29, 2009 6:36 am    Post subject: Reply with quote

Not a problem Hubert.
Glad everything worked out.

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