INTERACT FORUM

Windows => Third Party Plug-ins, Programs, and Skins => Topic started by: MrC on December 15, 2013, 11:29:46 pm

Title: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on December 15, 2013, 11:29:46 pm
I've created an extensible program that uses scriptlets to manipulate, and do work based on, MC fields.  This allows you to select a set of files in MC, run the scriptlet, and have the new calculated values automatically stored back into one or more MC fields.  Think of it like MC's expression language on steroids.  It also allows you to perform additional actions based on values collected from the selected files.

The scriptlets are written in Perl, as is the main program pscriptor.pl.  This means pscriptor.pl is cross-platform - it can be used on Windows, Mac OS X, or Linux.  The Perl script can be written on the command line, or stored for later in a file (especially useful for more complex scripts).

I've included a some example scriptlets:

   - sample scriptlets that explain how to code a scriptlet (simple and complex cases)
   - get a music file's embedded cover art dimensions
   - convert names in the form of Last, First into First Last
   - uppercase the first letter of a name, except for those sub-names in an exception list
   - swap values of the form role:Artist into Artist:role
   - reports on fields with case differences
   - creates m3u playlists from files in a view
   - randomly fills Playback Range with a given range for true random track sampling
   - acoustic fingerprint audio analysis for track detection and musicality information
   - detect and retrieve dates from arbitrary fields
   - copy the topmost field from an arbitrary grouping of files, and push it downward in the group
   - copy and merge all the values in a field, removing duplicates
   - provide a sequence of numbers
   - make a random playlist of N files and start playback to a specified zone
   - obtains a list of each file's full playlist paths
   - test / verify a media file
   - copy files with flexible folder and file names (including sequence #'s) and create M3U8 playlists
   - makes particles and chapters from ripped Blu-ray discs with metadata lookups from ChapterDB.org

I'll add more samples as requested, the idea being that the body of scriptlets will increase over time.  If you know Perl, you're free to experiment, create and share your own.

I've had the idea of doing this for a while, but was prompted by a request in another thread (http://yabb.jriver.com/interact/index.php?topic=85913.msg587873#msg587873).  The problem in that thread was to globally reverse a list of role:Artist values to Artist:role.  Since MC doesn't have global substitution with regular expressions, pscriptor.pl has been born of necessity to get the job done.

Download the attached zip file, and unzip the items to a folder (right-click > Extract All).  See the README files inside the folder.  Refer to the instructions inside.  The instructions and descriptions that follow this post while perhaps useful will often be inaccurate as new releases or pscriptor are posted.

MC19 is required currently.

Here are a couple of quick screen movies showing it in action:
- - See the Demo movies at the download site in the Instructions
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: Arindelle on December 16, 2013, 03:52:26 am
Hey Bravo Mr. C! You've done it again! This will have to wait a bit until after Christmas for me to test ... up to my eye-balls in things to do.

For those of you who might have missed this, check out Mr. C's AMG tag tool http://yabb.jriver.com/interact/index.php?topic=84268.0 (http://yabb.jriver.com/interact/index.php?topic=84268.0)

Hmm a "steak" nominee? Careful Glynor, better start pumping out those brilliant guides of yours.

Or will this years Porterhouse be chicken filets ?  ;)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: JimH on December 16, 2013, 07:09:31 am
MrC,
Thanks very much (again).  You could post a notification over on the MC19 board and point people here.  I think a lot of people will find it interesting.

Jim
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on December 16, 2013, 12:57:47 pm
Version 1.03 posted:
    - Change: field names specified with -f are now case insensitive
    - Fix: ensure fields specified with -f are in the view (and on the
      clipboard).
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MusicBringer on December 16, 2013, 01:13:31 pm
MrC,
Thanks very much (again)
Hear! Hear!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: Fred1 on December 19, 2013, 04:24:22 am
Just discovered your new project - sounds very interesting!

Does this work on a Mac, too (MC-wise)?
Is ist possible to send clipboard content to MC-Mac? I tried that, but failed.
None of the apps like Keyboard Maestro or Quicksilver will work for me on MC-Mac.
So i wonder if there is a way to do this.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on December 19, 2013, 11:35:46 am
Does this work on a Mac, too (MC-wise)?
Is ist possible to send clipboard content to MC-Mac? I tried that, but failed.
None of the apps like Keyboard Maestro or Quicksilver will work for me on MC-Mac.
So i wonder if there is a way to do this.

Yes, it works on the Mac.  That's where I do the development.

You need Mac::Pasteboard and a couple more modules installed.  I use MacPorts to install most packages, and that also requires installing XCode.  So the bootstrap process is larger than for windows, where ActivePerl has the pre-compiled binaries.

Ask offline if you want to move forward (send me a PM).
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on December 19, 2013, 05:18:20 pm
So this is kinda fun.

Over in this thread (http://yabb.jriver.com/interact/index.php?topic=86021.msg588816#msg588816), which is part of a duplicates detection scriptlet, I realized I can create another scriptlet which does track and metadata lookup entirely by acoustic fingerprinting lookup (via echoprint (http://echoprint.me/)).

So I started playing with this.  Let's see where it goes.

Returned from the lookup are a number of useful fields, for example;:

 "songs":
      "title": "Utopia",
      "artist_discovery": 0.39565332550298865,
      "artist_name": "Goldfrapp"
      "id": "SOVLXBI13167714CE8"
      "score": 77,
      "artist_id": "AR8K3HD1187B9B9CA9",

"audio_summary":
      "key": 2,
      "energy": 0.68320400000000003
      "liveness": 0.065955
      "tempo": 91.018000000000001
      "speechiness": 0.026283000000000001
      "acousticness": 0.013006
      "mode": 0
      "time_signature": 4
      "duration": 258.02620999999999
      "loudness": -6.4770000000000003
      "audio_md5": "88e2e52a8deaa86f83243898f0675213"
      "valence": 0.17689199999999999
      "danceability": 0.43351400000000001

So this might be a useful way to lookup untagged tracks for some identification, or for other audio-analysis info.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on January 14, 2014, 01:14:42 pm
I've updated pscriptor to version 1.04.  See the Changes file for more info.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: connersw on January 15, 2014, 09:39:49 am
Maybe I read too much into it, but in the Read Me Step 1 where it says to configure the MCWS_server in pscriptor-config.txt, I assumed this would be IP Address:52199.  This gave me a time out error.  It ran fine just using localhost:52199.

Thanks for this and Random Playback scriptlet.  Will give me more reasons to waist time playing with MC.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on January 15, 2014, 11:09:21 am
An IP Address works fine, so long as it is the correct one.  The hostname "localhost" just gets translated by the operating system DNS libraries into the IP address 127.0.0.1.  Perhaps you used in external (WAN) IP address instead of your LAN private address?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: connersw on January 15, 2014, 02:46:02 pm
Yes, that is what I was doing.  LAN works.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 01, 2014, 02:04:30 pm
As mentioned a few posts above, I toyed with some acoustic fingerprinting as a scriptlet.  I have it working on a the Mac, but I had to compile an executable as part of the toolset.  To make this scriptlet available on Windows, I'll have to do the same (and probably make binaries available to you to download).  So I'm wondering, does anyone have any interest in this?  Here is the scriptlet in action - it correctly identifies all the tracks from Moby's Play album:

   https://dl.dropboxusercontent.com/u/87189402/AcousticFingerprint.mp4 (https://dl.dropboxusercontent.com/u/87189402/AcousticFingerprint.mp4)

The fingerprint software I'm using provides the following 13 values, which I'm pushing back to MC along with the track Name and Artist:

Key/Value: key: 4
Key/Value: energy: 0.325266
Key/Value: liveness: 0.51388699999999998
Key/Value: tempo: 171.143
Key/Value: speechiness: 0.031287000000000002
Key/Value: acousticness: 0.182311
Key/Value: mode: 1
Key/Value: time_signature: 4
Key/Value: duration: 218.57288
Key/Value: loudness: -10.608000000000001
Key/Value: audio_md5: 53afc1cb8d9a5b6984d573eb4a24fefa
Key/Value: valence: 0.037865999999999997
Key/Value: danceability: 0.085136000000000003

No Album value is available, as a track could be present on many albums.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: bunglemebaby on February 07, 2014, 02:47:42 pm
So I'm wondering, does anyone have any interest in this?  

Yes.
Of course, that also comes with the question of how much effort does it require to build a separate executable for Windows? Don't spend hours on my account and all that....

Is the Acoustic Fingerprint the one generated by MC or do we need to do that separately (using what utility if so)?

-Jon
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 07, 2014, 03:19:02 pm
No, the fingerprinting software is the open source Echoprint:

    http://echoprint.me/

and the particular program required is codegen.  It performs the analysis, and then the scriptlet submits the analysis data to a web server for look-up.

They don't provide binaries for codegen because of the licensing issues with certain software packages.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 14, 2014, 06:47:22 pm
After completing a bunch of projects, I turned my attention back to the Acoustic Fingerprinting scriptlet.  I now have it compiled for Windows, and just ran some tests; it is working fine. It seems reasonably fast, taking about 13 seconds to identify all 10 tracks in an album.

I need to product-ize the scriptlet a bit so that you can customize how the returned values are mapped into MC fields, and whether or not you want Artist and (track) Name populated.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: alspoll on February 15, 2014, 02:27:41 pm
Editor's amendment:

Split from a topic over here:

   http://yabb.jriver.com/interact/index.php?topic=76147.msg599135#msg599135 (http://yabb.jriver.com/interact/index.php?topic=76147.msg599135#msg599135)

Quote from: alspoll
Glynor,

Is there a way for this to be used with Mediainfo to pull back stream count for audio and text (subtitles)?

What I want to do is to identify video files where there are multiple audio and subtitles streams so I can remux them to remove them to save on some harddrive space (I envision adding 2 fields in jriver audio stream count and subtitle stream count and then creating a smartlist afterwards with > 1 to review).

I looked at mediainfo and see it supports command line, but is beyond my understanding on how to use it and your program to populate MC19.

TIA,

AL

While glynor has not yet had a chance to respond...

What types of files are you wondering about?  Most of mine are mkv files, and are single-stream, and I've never bother pulling the subtitles, etc., so I perhaps don't have the necessary data for evaluating what the mediainfo command line results would look like in your case.


I have a mix of file types, (avi, mkv, mp4, etc).

I have a lot of foreign films and anime with dual audio streams that I want to identify and remove the English dub streams.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 15, 2014, 02:38:14 pm
Provided that the mediainfo output indicates this, if glynor's tool(s) cannot do what you need, my pscriptor (http://yabb.jriver.com/interact/index.php?topic=85990.0) tool will be able to; it just needs a simple scriptlet to call mediainfo and gather/process the results.  It can then fill in MC's fields with the desired results.

What I'm not clear on yet is if a single mkv, avi, or mp4 file contains multiple streams (and therefore mediainfo on that file will output the relevant info), or if your multiple streams are contain each in a single file (and then mediainfo would have to process several files at once and that output collected and processed).

If you're interested in going the pscriptor route, I'll rip some multi-track files w/subtitles and see what the results are.

You could also download, install and run the mediainfo command line tool, and evaluate the output against a single media file.  It is easy to run.  Just open a command window, and probably increase the height of the window, type the full path to where you stored the mediainfo executable, and pass it a full path to a media file.  Use the --full option too.   Example:

   c:\mediainfo\mediainfo.exe  --full M:\Movies\somemovie.mkv
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: alspoll on February 15, 2014, 02:49:43 pm
Here is an example...

Karas  - The Prophecy has 2 audio streams (English and Japanese) and 2 subtitle streams (2 English) ...

I attached a screeenshot of media info for this file..

Thanks for your help.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 15, 2014, 03:07:07 pm
Can you download the command line tool and get the output of that file?

You can redirect the output to a file for easy posting.  Just add:

   > output.txt

to the end of the command line.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: alspoll on February 15, 2014, 03:25:50 pm
hmm...  file is coming back blank...

i entered this into the command prompt. files is created, but nothing was written. i validated i downloaded the cli version of the tool.

e:\mediainfo\mediainfo.exe  --full M:\Movies\Karas  - The Prophecy\Karas  - The Prophecy.mkv > output.txt
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 15, 2014, 03:26:29 pm
I ripped a multi-channel audio w/subtitles disc to DVD.  The command line output indicates there are two text streams and two audio streams, so it seems easy enough to grab / store this info.

Please indicate if you're interested in pscriptor, and I'll write you the scriptlet to provide the info you need.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 15, 2014, 03:27:20 pm
You'll need double quotes w/file paths contain whitespace:

  e:\mediainfo\mediainfo.exe  --full "M:\Movies\Karas  - The Prophecy\Karas  - The Prophecy.mkv" > output.txt
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: alspoll on February 15, 2014, 03:33:13 pm
Thank you, that worked.

Here is the output.

General
Count                                    : 284
Count of stream of this kind             : 1
Kind of stream                           : General
Kind of stream                           : General
Stream identifier                        : 0
Unique ID                                : 264338026680190436507004806273882760741
Unique ID                                : 264338026680190436507004806273882760741 (0xC6DDA6F02E2A7F713A0DFDB7C105A625)
Count of video streams                   : 1
Count of audio streams                   : 2
Count of text streams                    : 2
.
.
.
.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: alspoll on February 15, 2014, 03:42:41 pm
MrC,

I am interested in using pscriptor.

I appreciate your help with the scriptlet.

Thank you.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 15, 2014, 03:50:20 pm
Ok, will do. I'll have something for you after I get back from getting some lunch...
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 15, 2014, 05:05:31 pm
I've posted version 1.05 of pscriptor.

Changes Version 1.05:
    - Change: updated the README instructions to better explain unzipping the pscriptor
      contents into a folder.
    - New: scriptlet RandomPlaybackRange can obtain its playback duration from the view.
    - Fix: scriptlet RandomPlaybackRange's duration was off-by one.
    - Fix: scriptlet MakePlaylist was not properly encoding the playlist file names in Windows.
    - New: scriptlet GetIDV3Tag can pull a tag (frame) from an IDV3-tagged media file.
    - New: scriptlet GetMediaInfo will call the mediainfo executable and return the number of audio and text streams.
    - New: scriptlets can now return hash of field key/value pairs which will update MC fields.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 15, 2014, 05:15:32 pm
@alspoll: Version 1.05 just posted provides you with a new scriptlet GetMediaInfo.  Download and install it.  

Here's how you use it:

   perl pscriptor.pl -c pscriptor-config.txt -E GetMediaInfo -f "your field name"

where your field name is the MC field name you want filled (double quoted if it contains spaces).

It will populate the field with a value like:

   audio_streams: 2; text_streams: 3

which you can split into two other expression fields automatically with the expressions:

   Audio Stream Count:
        removeleft(listitem([your field name], 0), 15)
   Video Stream Count:
      removeleft(listitem([your field name], 1), 14)

The script assumes that mediainfo.exe is in your Windows PATH somewhere.  If it is not, do any one of the following:

  - update your Windows PATH to include mediainfo's folder
  - move the mediainfo.exe file somewhere in your PATH
  - edit the Scriptlet/GetMediaInfo.pm file and set the $exe_path_win variable to specify the full path to mediainfo.exe.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: alspoll on February 15, 2014, 05:28:52 pm
Thank you very much for the addition of the mediainfo scriptlet.

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 15, 2014, 05:36:15 pm
You're welcome.

This was just a quick scriptlet to a) get you the info you needed, b) to also serve as a template for other uses of mediainfo, and c) show in general of how easy and quick it is to write scriptlets.
Title: Re:
Post by: nitephlight on February 16, 2014, 08:32:00 pm
This is fantastic work can't wait to try it out. You're truly a valuable asset to this community, thanks again!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 16, 2014, 08:43:41 pm
Blush.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 17, 2014, 08:17:50 pm
I've published version 1.06, which includes the new AcousticFingerprint scriptlet.  This scriptlet will analyze audio tracks, returning track name, artist, and various musicality information.

Changes Version 1.06
    - Fix: disable debug output for scriptlet hash returns (internal change).
    - New: first release of the AcousticFingerprint scriptlet for audio identification and analysis.  You will need two
      executables, one ffmpeg, and the other the acoustic analysis program called 'codegen'.  See the comments at the
      top of the Scriptlets/AcousticFingerprint.pm file.   Codegen and server-based analysis is provided by the open
      source Echo Nest project (http://echonest.com/).  Example usage:

          perl pscriptor.pl -c pscriptor-config.txt -E AcousticFingerprint -f 'Name'

      The field selected with -f doesn't matter, as the scriptlet does not use it; it just has to be one in the view (I'll eliminate this requirement later).
Title: Re:
Post by: nitephlight on February 17, 2014, 08:45:46 pm
Hm downloads in OP missing or tapatalk f#+/+ing with me as usual lol
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 17, 2014, 08:50:28 pm
The download is there.
Title: Re: Reading Recorded Date from Home Videos Imported into MC
Post by: glynor on February 17, 2014, 08:52:40 pm
It would be quite trivial to use a modified version of the scriptlet to update your Date Recorded field from mediainfo's output.  Let me know if you want a scriptlet for this...

I really need to spend some time checking it out.  I'm sure I can figure out the scriptlet design to make my own.

The one thing I was concerned with (I admit, I haven't tried it at all) is from your initial descriptions it wasn't clear if I can easily call pscriptor to act on a particular file by filename.  If so, I can easily automate any scripts I want to do with pscriptor to happen automatically via MCAutoQueue (which, when combined with a Tag On Import rule, will just happen "automatically").

It looked like it was certainly pretty flexible, but I saw a lot of references in your thread to "selecting files" (interactively in MC's UI).  I can already do most of the things I want manually, but I'd love to be able to use pscriptor (instead of writing my own generic tagging tool) in an automated fashion.

Before I dig in, set my mind at ease... Show me a command line that acts on a single file by [Filename].  ;)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: glynor on February 17, 2014, 08:59:28 pm
https://dl.dropboxusercontent.com/u/87189402/get%20cover%20art%20size.mp4

(http://glynor.com/img/screenshots/other/pscriptor-broken_video.png)

 :'(

Solution (https://vimeo.com/).
Title: Re: Reading Recorded Date from Home Videos Imported into MC
Post by: MrC on February 17, 2014, 09:01:00 pm
Pscriptor works by grabbing the Filename from the clipboard's CSV table.  It will either use an already copied selection of MC view rows, or will call MCWS to do the copy for you when using MCWS.

It also needs the Fields in the view that are going to be used for calculation, and those that are going to be changed, so it can grab and compare the old and new values (no sense sending back the same value to MCWS).

I imagine I could add a Filename or FileKey option, where you would pass the filename.  But I'd also need to update it to pull values from MCWS, and provide another option or two to specify which fields you want to use.  This might get a little complex, but I haven't spent much time thinking about this.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 17, 2014, 09:02:39 pm
It played here, in the browser.  Maybe download and play it?
Title: Re: Reading Recorded Date from Home Videos Imported into MC
Post by: glynor on February 17, 2014, 09:02:53 pm
Pscriptor works by grabbing the Filename from the clipboard's CSV table.  It will either use an already copied selection of MC view rows, or will call MCWS to do the copy for you when using MCWS.

I was worried about this, from the demo video of yours I was able to watch, it seemed like this was the case.

I'm going to move this discussion to your pscriptor thread.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: glynor on February 17, 2014, 09:05:44 pm
Using Dropbox to deliver video on the web isn't reliable.  Their storage system (http://aws.amazon.com/s3/) is NOT optimized for that kind of data transfer.
Title: Re: Reading Recorded Date from Home Videos Imported into MC
Post by: glynor on February 17, 2014, 09:18:27 pm
or will call MCWS to do the copy for you when using MCWS.

How does this part work?

My issue is that, while I have a bunch of these already, it is an ongoing concern.  I can go through and select the ones already funky, which would help.  But, to me, any "fix" like this is only valuable if it will be consistently applied.  The only way to ensure that it is consistently applied, is if it happens automatically.

Otherwise, it is better not to even have the view that uses the data.  Because it can't be "trusted" (or it relies on me being "on top of it" for it to be trust-able, and that's the same thing).

So, for pretty much any use-case I can think of, if I need to be at an interactive console, the utility is extremely limited.  That could come in handy if I had some kind of one-off tagging task that I need to Just Get Done (kind of like a Right-Click > Send To > Targeted Fixer), but... Honestly, there isn't much that the built-in expression language can't do already that I need regularly in ways like this.

For an "expression extension" type of utility to be really useful, I need to be able to apply the scripts over and over, automatically, as files come into the Library.  I think I've built a good tool for exactly that (and it can dump out whatever field values you want from MC, even results of expressions), but I don't have a general-purpose and extensible way to then dump "results" back into tags in MC.

I could, of course, build one, but I'd hoped pscriptor could serve that kind of purpose (especially since it is cross platform).
Title: Re: Reading Recorded Date from Home Videos Imported into MC
Post by: MrC on February 17, 2014, 09:33:46 pm
How does this part work?

    mcws_do_mcc_command(\%mcwsparams, 21000);

My issue is that, while I have a bunch of these already, it is an ongoing concern.  I can go through and select the ones already funky, which would help.  But, to me, any "fix" like this is only valuable if it will be consistently applied.  The only way to ensure that it is consistently applied, is if it happens automatically.

So, for pretty much any use-case I can think of, if I need to be at an interactive console, the utility is extremely limited.  That could come in handy if I had some kind of one-off tagging task that I need to Just Get Done (kind of like a Right-Click > Send To > Targeted Fixer), but... Honestly, there isn't much that the built-in expression language can't do already that I need regularly in ways like this.

For an "expression extension" type of utility to be really useful, I need to be able to apply the scripts over and over, automatically, as files come into the Library.  I think I've built a good tool for exactly that (and it can dump out whatever field values you want from MC, even results of expressions), but I don't have a general-purpose and extensible way to then dump "results" back into tags in MC.

I could, of course, build one, but I'd hoped pscriptor could serve that kind of purpose (especially since it is cross platform).

I suppose there are many different usage scenarios, yours primarily being automated processing of incoming files.  For that, you probably have a limited set of fixed tasks, and you just need an external driver/evaluator.  There are other uses where automatic flow doesn't really work, because users need to provide additional data or control.

If you have a Filename, and the fields you want evaluated, could you place this in CSV format on the clipboard?  Then it would just work (I'd add an option to not auto-copy).
Title: Re: Reading Recorded Date from Home Videos Imported into MC
Post by: glynor on February 17, 2014, 09:41:23 pm
    mcws_do_mcc_command(\%mcwsparams, 21000);

Ahh, I see.  So you still have to have them selected in the UI.

I suppose there are many different usage scenarios, yours primarily being automated processing of incoming files.  For that, you probably have a limited set of fixed tasks, and you just need an external driver/evaluator.  There are other uses where automatic flow doesn't really work, because users need to provide additional data or control.

Yep, exactly.  I see how it could be useful as-is for some purposes.  I just generally don't design my "needs" such that I can't accomplish things with the existing toolset.  If I want to change something structural about the Library, it has to be something I can do long-term, you know?

As I mentioned, writing a one-off to do something like this with my existing C# library would be trivial.  It can, obviously, already write to tags (that's how MCAutoQueue sets the [NeedsProcessing] flag to Completed or Failed or whatever).  But that would be a "Use MediaInfo to do X" kind of applet, not a general purpose tool where I could think up new uses later on without having to fire up the compiler.  Something more general purpose is a much bigger task, obviously (as you well know, I expect).
Title: Re: Reading Recorded Date from Home Videos Imported into MC
Post by: glynor on February 17, 2014, 09:42:23 pm
If you have a Filename, and the fields you want evaluated, could you place this in CSV format on the clipboard?  Then it would just work (I'd add an option to not auto-copy).

Dunno.  Possibly.

I might be able to write some kind of pscriptor connector utility...
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 17, 2014, 09:48:45 pm
Or an MPL, or XML or whatever.  The key things are for me to get the data you want operated on, and we want to avoid trying to pass complex params via the Windows (awful) command line.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 17, 2014, 09:53:48 pm
Alternatively, maybe I can construct the data via MCWS.  I'd just need a list of filenames or filekeys, and a list of fields.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 19, 2014, 08:48:37 am
Here's an example of how AcousticFingerprint can be useful to detect duplicate files, even with different file encodings and compressions:

   http://yabb.jriver.com/interact/index.php?topic=87575.0 (http://yabb.jriver.com/interact/index.php?topic=87575.0)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 19, 2014, 10:06:52 am
And another example, with a new script, that outputs which albums have missing discs and/or tracks (holes).

   http://yabb.jriver.com/interact/index.php?topic=84396.msg599818#msg599818 (http://yabb.jriver.com/interact/index.php?topic=84396.msg599818#msg599818)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: lepa on February 19, 2014, 03:00:39 pm
So this thing can fetch the audio and subtitle streams language names and write them to the tags? That would be nice! Been thinking to request this when MC analyses videos...
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on February 19, 2014, 03:18:36 pm
If you are referring to what mediainfo can report, then yes, it can grab that info.

Think of pscriptor this way.  It:

  1) is a per-file iterator program, that...
  2) performs scripted operations on those files and their metadata, and ...
  3) can update the file's metadata or do other things
Title: Re: Reading Recorded Date from Home Videos Imported into MC
Post by: MrC on February 25, 2014, 12:57:12 pm
Dunno.  Possibly.

I might be able to write some kind of pscriptor connector utility...

@glynor - are you still interested in this?  This morning I've been thinking about mechanisms you could use to fire off pscriptor from your tool set.  I'm not keen on passing a filename via Windows cmd shell, because there are Unicode issues involved, if your filenames have any Unicode characters.  However, a FileKey() would be great.  I could add a code path that would accept a FileKey as input, ignore the old vs. new data comparison and just always return the new value via MCWS.  No clipboard or selection required.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 23, 2014, 12:15:40 pm
I've posted version 1.07 which includes a a few new scriptlets, and includes the ability to define an output field for each input field.

Version 1.07 Changes:
    - New: fields supplied with -f can now include an output field.  Normally any -f field will be
      used as input, and after the script acts on that field value, the value returned from the
      script or scriptlet will be used to update that same field.  However, there are cases when
      it is useful to use one field as input, and another field as output.  To specify both input
      and output fields, use the new form -f "infield::outfield" on the command line.  Unlike the
      input field, the output field does not have to be in the view; however, having it in the view
      provides better performance because pscriptor avoids sending updates for unchanged values.
    - New: scriptlet DateParse attempts to find dates in fields and outputs a uniform date string.
    - Internal: amg.pl, discogs.pl, and pscriptor.pl now share common modules (MCUtils::MCWS, MCUtils::Misc).
    - Fix: typo in AcousticFingerprint MC field name for artist_id.
    - New: scriptlet MissingTracks, which outputs missing discs and/or tracks from albums.

Note: the DateParse scriptlet requires an additional module to be installed.  See the instructions at the top of the scriptlet file.
Note: DateParse outputs a string date, not an MC Date value, so define your field as a String.
Title: Using Fingerprinting to Deduplicate
Post by: stiv32 on March 24, 2014, 04:18:56 pm
I tried Mr C's pscriptor to add fingerprint to my files.

Firstly I created the Expression fields En ..., needed and added them at the view panel of MC.

I have tried of adding fingerprint to about 500 files. Firlstly I tried individual files playing with commands until it worked. The command I used is

perl pscriptor.pl -E AcousticFingerprint -v -c pscriptor-config.txt -f Name

Then I added the command to about 300 files. None of them returned any fingerprint string.

After that I found the album of the song that returned fingerprints before. I tried other songs of the same album and returned fingerprints as well.

My question is,

am I doing something wrong? Does pscriptor return a fingerprint at each song; even if the song is not at the online database? Should I use a different command?
Title: Re: Using Fingerprinting to Deduplicate
Post by: stiv32 on March 24, 2014, 04:29:06 pm
This might be helpful.

At the batch fingerprinting I get this:

...
...
...
        in(name): 'Garufa'
        old=new(name): <unknown>        field(name) UNCHANGED: null value return
ed from script
File: x:\t\music\classic\Tangata Rea\Tango All╬▒ Baila\Gar╧Λa Tangata Rea 1999.m
p3
Uncaught exception from user code:
        MCWS write failed:
        http://localhost:52199/MCWS/v1/File/SetInfo?Value=need%20codes%20in%20qu
ery%20for%20fingerprint%20matching&Field=&FileType=Filename&File=X%3A%5Ct%5Cmusi
c%5Cclassic%5C(Various%20Artists)%5CUnknown%20Artist%5CUnknown%20Album%5C11-TUDO
%20CABE%20NUM%20BEIJO(FT-cancao)%20Manoel%20Reis%20com%20Dianas%20do%20c%C3%A9uV
ic%2034335-2-1938.mp3
        500 Internal server error
        <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
        <Response Status="Failure" Information="Field not found."/>
        MCUtils::MCWS::send_items('MCUtils::MCWS=HASH(0x11b88f4)', 'REF(0x244a67
c)') called at MCUtils/MCWS.pm line 55
        MCUtils::MCWS::send('MCUtils::MCWS=HASH(0x11b88f4)', 'ARRAY(0x229bf8c)')
 called at pscriptor.pl line 188




When I try to get fingerprint from one file without success I get this:

C:\Users\PCCCCCC\pscriptor>perl pscriptor.pl -v -c pscriptor-config.txt -E Acous
ticFingerprint -f Name
File: X:\t\music\classic\Juan D'Arienzo - Su obra completa en la
RCA Vol 35-48\Juan D'Arienzo - Su obra completa en la RCA Vol 01-1935-1936\11 Or
questa Juan D'Arienzo - Orillas Del Plata-Instrumental(31-12-1935).mp3
        Track lookup - No results found: ...\Juan D'Arienzo - Su obra completa e
n la RCA Vol 35-48\Juan D'Arienzo - Su obra completa en la RCA Vol 01-1935-1936\
11 Orquesta Juan D'Arienzo - Orillas Del Plata-Instrumental(31-12-1935).mp3
        in(name): 'Orillas Del Plata-Instrumental'
        old=new(name): <unknown>        field(name) UNCHANGED: null value return
ed from script

and also

...\2. Epoca de Oro\Alfredo De ┴ngelis\Cantores\Fl
oreal Ruiz\Marioneta(J.J.Guichandut,A.Tagini) - De ┴ngelis, F.Ruiz (23.7.1943).m
p3
Use of uninitialized value $code in join or string at
        Scriptlets/AcousticFingerprint.pm line 90 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.

    To help you figure out what was undefined, perl will try to tell you
    the name of the variable (if any) that was undefined.  In some cases
    it cannot do this, so it also tells you what operation you used the
    undefined value in.  Note, however, that perl optimizes your program
    anid the operation displayed in the warning may not necessarily appear
    literally in your program.  For example, "that $foo" is usually
    optimized into "that " . $foo, and the warning will refer to the
    concatenation (.) operator, even though there is no . in
    your program.

Use of uninitialized value within %fieldmap in hash element at
        Scriptlets/AcousticFingerprint.pm line 129 (#1)





and when I successfully get fingerprint from a file I get the following:

C:\Users\PCCCCCC\pscriptor>perl pscriptor.pl -v -c pscriptor-config.txt -E Acous
ticFingerprint -f Name
File: X:\t\music\classic\Alfredo De Angelis\From Argentina to
 the world\Altar sin luz.mp3
        Track lookup - No results found: ...\Alfredo De Angelis\From Argentina t
o the world\Altar sin luz.mp3
        in(name): 'Altar sin luz'
        old=new(name): <unknown>        field(name) UNCHANGED: null value return
ed from script





Title: Re: Using Fingerprinting to Deduplicate
Post by: MrC on March 24, 2014, 05:31:30 pm
I've merged the topic into this pscriptor thread.  It really belongs here since it is only relevant to users of pscriptor.

Let's work on one file until you have it working correctly.

Firstly I created the Expression fields En ..., needed and added them at the view panel of MC.

I hope you are using the wrong terminology.  How exactly are you defining the fields?  They should not be Calculated Data fields - they are just user fields.

   - Show one of your field definitions.
   - Show how you have fields defined inside AcousticFingerprint.pm (if you have changed the mappings).

Use -d to get more debug output.


My question is,

am I doing something wrong? Does pscriptor return a fingerprint at each song; even if the song is not at the online database? Should I use a different command?

From your output in the thread above:

            <Response Status="Failure" Information="Field not found."/>

this would indicate a field is not defined, and looking at the query:

        MCWS write failed:
        http://localhost:52199/MCWS/v1/File/SetInfo?Value=need%20codes%20in%20qu
ery%20for%20fingerprint%20matching&Field=&FileType=Filename&File=X%3A%5Ct%5Cmusi
c%5Cclassic%5C(Various%20Artists)%5CUnknown%20Artist%5CUnknown%20Album%5C11-TUDO
%20CABE%20NUM%20BEIJO(FT-cancao)%20Manoel%20Reis%20com%20Dianas%20do%20c%C3%A9uV
ic%2034335-2-1938.mp3

there is no Field name here (it is empty - nothing but an & after the = char).  Now I also see the text "need%20codes%20in%20qu
ery%20for%20fingerprint%20matching". Replacing the %20 with space it reads "need codes in query for fingerprint matching".  So this appears that something is not working correctly.  Have you successfully used this before?  If I recall correctly, that error indicates codegen is not running successfully.

Try running codegen directly on a file, such as:

   codegen C:\path\to\audio\file

What results do you get?

By the way, increase the width of your console so that your copy/paste looks better.
Title: Re: Using Fingerprinting to Deduplicate
Post by: MrC on March 24, 2014, 05:44:19 pm
This might be helpful.

At the batch fingerprinting I get this:


There's no "batch" fingerprinting.  pscriptor works one file at a time, calling the scriptlet for each file.  So you're always just working on one file at a time, even though pscriptor will iterate over each selected file.




C:\Users\PCCCCCC\pscriptor>perl pscriptor.pl -v -c pscriptor-config.txt -E Acous
ticFingerprint -f Name
File: X:\t\music\classic\Juan D'Arienzo - Su obra completa en la
RCA Vol 35-48\Juan D'Arienzo - Su obra completa en la RCA Vol 01-1935-1936\11 Or
questa Juan D'Arienzo - Orillas Del Plata-Instrumental(31-12-1935).mp3
        Track lookup - No results found: ...\Juan D'Arienzo - Su obra completa e
n la RCA Vol 35-48\Juan D'Arienzo - Su obra completa en la RCA Vol 01-1935-1936\
11 Orquesta Juan D'Arienzo - Orillas Del Plata-Instrumental(31-12-1935).mp3
        in(name): 'Orillas Del Plata-Instrumental'
        old=new(name): <unknown>        field(name) UNCHANGED: null value return
ed from script


This track is not being detected at echo nest, so nobody had added it yet, or the offsets need to change to match this track.  Let's assume this track is not in the database, given its title.


...\2. Epoca de Oro\Alfredo De ┴ngelis\Cantores\Fl
oreal Ruiz\Marioneta(J.J.Guichandut,A.Tagini) - De ┴ngelis, F.Ruiz (23.7.1943).m
p3
Use of uninitialized value $code in join or string at
        Scriptlets/AcousticFingerprint.pm line 90 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.

    To help you figure out what was undefined, perl will try to tell you
    the name of the variable (if any) that was undefined.  In some cases
    it cannot do this, so it also tells you what operation you used the
    undefined value in.  Note, however, that perl optimizes your program
    anid the operation displayed in the warning may not necessarily appear
    literally in your program.  For example, "that $foo" is usually
    optimized into "that " . $foo, and the warning will refer to the
    concatenation (.) operator, even though there is no . in
    your program.

This seems to indicate that codegen is failing to run, since you don't have the $code value (it is what is returned by the codegen program).  Since I don't know exactly how you've set this up, its hard to further diagnose.  Use -d to help provide more info.


and when I successfully get fingerprint from a file I get the following:

C:\Users\PCCCCCC\pscriptor>perl pscriptor.pl -v -c pscriptor-config.txt -E Acous
ticFingerprint -f Name
File: X:\t\music\classic\Alfredo De Angelis\From Argentina to
 the world\Altar sin luz.mp3
        Track lookup - No results found: ...\Alfredo De Angelis\From Argentina t
o the world\Altar sin luz.mp3
        in(name): 'Altar sin luz'
        old=new(name): <unknown>        field(name) UNCHANGED: null value return
ed from script

Same thing as above - the track is not found.  It is best to use tracks that are likely to be found first, until you get the kinks worked out.

I'm sure there are things for me to clean-up, as I didn't place a lot of error checking for things like incorrect installations, missing fields, etc.  That will improve over time.

I'll PM you my email address so that you can send more info regarding this matter to me directly and we can avoid spamming this thread.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 25, 2014, 08:09:05 pm
A quick follow-up, since we've taken the conversation offline.

1. There was some misunderstanding about how the AcousticFingerprint scriptlet works.  The tracks being looked up were not found in Echo Nest's (very large) database, as they were rare, old Argentinian tango songs from 1898 to 1940.

2. There was some confusion about the codes generated by the codegen program, and the back-end analysis and track matching done by the Echo Nest server that the AcousticFingerprint scriptlet calls.  The codes by themselves are not useful, and require the server to translate and look-up track and acoustic information based on those codes.

3. I've create two new scriptlets: CopyFirst and CopyAndMerge.  Each can be used to copy field values within a specified grouping of tracks.  CopyFirst pushes down the topmost value in the group and CopyAndMerge copies all the values within the group for each field and merges those into a semicolon-separated list of values.  stiv32 is testing out the new scriptlets and changes.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: winniew on March 26, 2014, 03:18:12 pm
I have a problem with the scriptlet GetCoverArtSize.

I have set up my new library field as string : "WW_CoverArtSize"

This is my commandline:
Code: [Select]
C:\Users\Winnie\Desktop\Pscriptor107>perl pscriptor.pl -v -t -c pscriptor-config.txt -f "WW_CoverArtSize" -E "Scriptlets\GetCoverArtSize"I get the following error:
Code: [Select]
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\01 - Bolero.mp3
Use of uninitialized value in subroutine entry at pscriptor.pl line 217 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.

    To help you figure out what was undefined, perl will try to tell you
    the name of the variable (if any) that was undefined.  In some cases
    it cannot do this, so it also tells you what operation you used the
    undefined value in.  Note, however, that perl optimizes your program
    anid the operation displayed in the warning may not necessarily appear
    literally in your program.  For example, "that $foo" is usually
    optimized into "that " . $foo, and the warning will refer to the
    concatenation (.) operator, even though there is no . in
    your program.

Undefined subroutine &main:: called at pscriptor.pl line 217 (#2)
    (F) The subroutine indicated hasn't been defined, or if it was, it has
    since been undefined.

Uncaught exception from user code:
        Undefined subroutine &main:: called at pscriptor.pl line 217.
        main::process_user_tracks('ARRAY(0x3368450)') called at pscriptor.pl line 186

What am I doing wrong?

Btw: Long time ago I used a similar script from Mr ChriZ:
http://yabb.jriver.com/interact/index.php?topic=51556.0 (http://yabb.jriver.com/interact/index.php?topic=51556.0)

Is it possible (with pscriptor) to fill the "Image File (width)" and "Image File (height)" as separate integer values?




Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 26, 2014, 03:24:44 pm
I have a problem with the scriptlet GetCoverArtSize.

I have set up my new library field as string : "WW_CoverArtSize"

This is my commandline:
Code: [Select]
C:\Users\Winnie\Desktop\Pscriptor107>perl pscriptor.pl -v -t -c pscriptor-config.txt -f "WW_CoverArtSize" -E "Scriptlets\GetCoverArtSize"
What am I doing wrong?

This:

   -E "Scriptlets\GetCoverArtSize"

should be the simpler:

   -E GetCoverArtSize

The actual name after -E must match the package name inside the scriptlet.  In your case, it won't (its a name, not a path).

Is it possible (with pscriptor) to fill the "Image File (width)" and "Image File (height)" as separate integer values?

Sure.  The scriptlet could be modified to return those values separately, or you could do it with another simple pscriptor call, or use MC expressions to split the values.  Which would you prefer?



Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: winniew on March 26, 2014, 03:44:13 pm
Wow, thank you, that was quick.
Now it works.

I would prefer one pscriptor call  which writes into seperate fields "WW_ImageFileWidth" and "WW_ImageFileHeight" (setup as Integer).

Thank you again for your help and your tool!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 26, 2014, 03:57:36 pm
You're welcome.  I'll have it for you after lunch.  Gonna get me some BBQ!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 26, 2014, 06:02:51 pm
I've updated pscriptor to version 1.08.  This version has many changes and goodies:

Version 1.08
    - New: option --args|-a allows passing scriptlets an argument string.
    - New: added pre-processing callback support to allow scriptlets a change to view all the data
      in the view before the per-file work is done (per-file is the only place where metadata updates
      are done).
    - New: scriptlet CopyFirst will copy the first value in a grouping, and push that value to
      other members of the grouping.  The -f option defines the fields for copying, and the new
      option -a specifies the column label that defines the grouping (e.g. Album).
    - New: scriptlet CopyAndMerge will copy all of the values in each -a defined grouping, for the
      field(s) specified with -f.  The per-grouping values will then be merged into a semicolon-
      delimited list, and saved to the output field defined by -f.
    - New: scriptlet GetCoverArtSize can now return WxH values as two separate fields.  See the comments
      in the scriptlet file.
    - Change: all scriptlets have been updated to accomodate the changed per-file callback argument
      list.
    - Fix: several improvements to scriptlet DateParse: reject date candidates beyond "today";
      disallow date components to be adjacent to another non-date digits; allow month-year dates,
      but coerce day to be 1.
    - Change: scriptlet MakePlaylist now accepts a grouping field via --args, but defaults to 'album'.
    - Change: scriptlet RandomPlaybackRange now accepts a playback duration via --args, or defaults to
      either a column named 'playback duration' or the default value of 30 (seconds).
    - Change: sample template scriptlets Sample and SamplePostProcessing were uppdated and renamed to
      SampleSimple and SampleComplete to reflect the new pre-processing callback and new arguments,
      and the comments were updated.
    - Internal: added code to the sample modules to breakpoint the perl debugger when it is enabled,
      making it easier to debug scriptlet modules.


@winniew - the updated GetCoverArtSize scriptlet is included.  You'll add an additional option and argument:

   ... -a WW_ImageFileWidth,WW_ImageFileHeight

See the comments above regarding both -a and GetCoverArtSize.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on March 27, 2014, 07:34:22 am
[ Edit: I've removed the link from this page, as I didn't want it posted here.  MrC ]
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: winniew on March 27, 2014, 12:10:34 pm
I'm just testing the new version 1.08 with the new scriptlet GetCoverArtSize.
It works for both:
1. Getting the Coverartsize as "width x height"
2. Getting separate fields for width and height

The only (no big) problem is, that it updates the fields in MC even when you use the switch "-t".

Even with switch -t it updates the fields in MC.
Code: [Select]
C:\Users\Winnie\Desktop\Pscriptor108>perl pscriptor.pl -v -t -c pscriptor-config.txt -f "WW_CoverArtSize" -E GetCoverArtSize
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\01 - Bolero.mp3
        in(ww_coverartsize): ''
        old(ww_coverartsize): <unknown>
        new(ww_coverartsize): '344x511'

Here the same for the separate fields (no comment in.. old.. new..)
Code: [Select]
C:\Users\Winnie\Desktop\Pscriptor108>perl pscriptor.pl -v -t -c pscriptor-config.txt -f "WW_CoverArtSize" -E GetCoverArtSize -a WW_Image_File_Width,WW_Image_File_Height
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\01 - Bolero.mp3

C:\Users\Winnie\Desktop\Pscriptor108>

So for me this is no real showstopper, but you should know the behaviour.
Perhaps I'm using the wrong switches in wrong order...
Thank you for your quick implementation.

WinnieW
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 27, 2014, 01:46:32 pm
@theoctavist - I removed the posted codegen link.  Using the same link posted at the top of the scriptlet, replace the .exe with .zip.  Sorry, I forgot to update the link there.  Nice drawing.

@winniew - good to hear of the success.  I'll correct the missing -t functionality.  Thanks for mentioning the issue.

The order of options generally doesn't matter (with the exception of where you place the -c <config file> option, and for my debugging purposes, where -d or -v is located).
Title: Re: Using Fingerprinting to Deduplicate
Post by: theoctavist on March 27, 2014, 04:30:22 pm
I've merged the topic into this pscriptor thread.  It really belongs here since it is only relevant to users of pscriptor.

Let's work on one file until you have it working correctly.

I hope you are using the wrong terminology.  How exactly are you defining the fields?  They should not be Calculated Data fields - they are just user fields.

   - Show one of your field definitions.
   - Show how you have fields defined inside AcousticFingerprint.pm (if you have changed the mappings).

Use -d to get more debug output.


From your output in the thread above:

            <Response Status="Failure" Information="Field not found."/>

this would indicate a field is not defined, and looking at the query:

        MCWS write failed:
        http://localhost:52199/MCWS/v1/File/SetInfo?Value=need%20codes%20in%20qu
ery%20for%20fingerprint%20matching&Field=&FileType=Filename&File=X%3A%5Ct%5Cmusi
c%5Cclassic%5C(Various%20Artists)%5CUnknown%20Artist%5CUnknown%20Album%5C11-TUDO
%20CABE%20NUM%20BEIJO(FT-cancao)%20Manoel%20Reis%20com%20Dianas%20do%20c%C3%A9uV
ic%2034335-2-1938.mp3

there is no Field name here (it is empty - nothing but an & after the = char).  Now I also see the text "need%20codes%20in%20qu
ery%20for%20fingerprint%20matching". Replacing the %20 with space it reads "need codes in query for fingerprint matching".  So this appears that something is not working correctly.  Have you successfully used this before?  If I recall correctly, that error indicates codegen is not running successfully.

Try running codegen directly on a file, such as:

   codegen C:\path\to\audio\file

What results do you get?

By the way, increase the width of your console so that your copy/paste looks better.

please forgive me my ignorance, but I am attempting to get the Acoustic Fingerprint of my entire media library for the removal of duplicates and lossy compression algorithm files.  what fields *must* be in jrmc? i am foggy on this point. i am entirely new with command line, perl, etc. so baby steps(although i did get the discogs scraper to work wonderfully! (thanks btw)

Title: Re: Using Fingerprinting to Deduplicate
Post by: MrC on March 27, 2014, 04:38:52 pm
please forgive me my ignorance, but I am attempting to get the Acoustic Fingerprint of my entire media library for the removal of duplicates and lossy compression algorithm files.  what fields *must* be in MC? i am foggy on this point. i am entirely new with command line, perl, etc. so baby steps(although i did get the discogs scraper to work wonderfully! (thanks btw)

No worries.  Although the identification returns 20 items, you only need to define/use the fields you want.   You can customize the field names in the scriptlet (soon I'll add per-scriptlet config file options so you don't have to muck w/source code).

The video in a previous post shows (http://yabb.jriver.com/interact/index.php?topic=85990.msg596648#msg596648) the field of interest for de-duping - the MD5 value.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 27, 2014, 10:09:31 pm
I've posted version 1.09.  It adds the ability to configure scriptlet options in the config file, so you don't have to edit the scriptlet source anymore.

Version 1.09
    - Fix: option --testonly | -t was not working correctly.
    - New: scriptlet options may be specified in the confile file.  See Scriptlet Options in the
      the config file for more informtion.
    - New: scriptlet GetIDV3Tag will use the tag name supplied via -a, or else from the field
      contents of the -f field.
    - Fix: scriptlet RandomPlaybackRange would incorrectly output a warning when -a was no used.
    - Fix: scriptlet RandomPlaybackRange was not setting the duration properly from -a.

@theoctavist: you no longer have to edit the AcousticFingerprint code to customize your fields - see the new config file, specifically the Scriptlet Options.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on March 28, 2014, 07:16:06 am
thanks Sir!

something dumb I know..but entering perl pscriptor.pl -E AcousticFingerprint -v -c pscriptor-config.txt -f Name


gives me "codegen not recognized as valuable blah blah or batch command

also 500 internal server error

nd "need codes in query for fingerprint matching.

ill get there, promise. just need gentle nudges ;)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 28, 2014, 12:15:07 pm
Enable QuickEdit Mode in your command shell.  Right-click the title bar, and select Properties and then the Options tab.  Ok your way out, and then increase the size of the window as much as you want.

Then, run the pscriptor command again. Copy the output - console is wierd, you select a block of text rather than lines, so be sure to select all the text.   Once selected, press Enter (this copies).  Now you can paste the error text.

It seems to me that you don't have the codegen program in your path.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on March 28, 2014, 04:12:52 pm
C:\Users\me\Desktop\pscriptor>perl pscriptor.pl -E AcousticFingerprint -v -c pscriptor-config.txt -f Name
File: H:\MY MUSIC LIBRARY\Giant Sand...proVISIONS(2008)[FLAC]\01. Stranded Pearl.flac
'codegen' is not recognized as an internal or external command, operable program or batch file.

...
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 28, 2014, 04:21:41 pm
I trimmed the extraneous output, and marked in red the problem.

Where did you place the codegen program?  It must be located in one of the directories in your Windows PATH variable, or you have to specify the full path in the config file.

You can see your path by typing:

   echo %PATH%

in the command shell.

Also, it looks like you don't have the latest version of pscriptor?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on March 28, 2014, 04:43:56 pm
hey, I *thought* I did.  i took that codegen zip and created a directory for it, re pscriptor, i took 1.09 and unzipped it to the folder i am using on the desktop, simply replacing the files with updated versions

full path is here.


C:\Users\me\Desktop\pscriptor> echo %PATH%
C:\Perl64\site\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Syste
m32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\WinS
CP\;C:\ffmpeg-20140327-git-62094e2-win32-static\bin\ffmpeg.exe;C:\ENMFP_codegen\
codegen.windows.exe;C:\codegenffmpeg\codegen.exe;C:\codegenffmpeg\ffmpeg.exe;C:\
codegen\codegen.exe
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 28, 2014, 04:45:52 pm

C:\Users\me\Desktop\pscriptor> echo %PATH%
C:\Perl64\site\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Syste
m32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\WinS
CP\;C:\ffmpeg-20140327-git-62094e2-win32-static\bin\ffmpeg.exe;C:\ENMFP_codegen\
codegen.windows.exe;C:\codegenffmpeg\codegen.exe;C:\codegenffmpeg\ffmpeg.exe;C:\
codegen\codegen.exe

You've added the name of the executable to the path.  Remove the red stuff.  PATH contains a list of directories.  It seems you've done likewise with several other executables too.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on March 28, 2014, 04:52:05 pm
haha!  :D

thank you! i am an idiot!  ;D
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 28, 2014, 04:52:54 pm
thank you! i am an idiot!  ;D

You're welcome.  Don't pick a fight with yourself.  The other guy is sure to lose.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on March 28, 2014, 05:12:43 pm
it works now, thank you! the only thing is, im not seeing the .md5 hash show up in jrmc field..maybe i set it up wrong? but i didnt see audio_md5 in the output ..just valence, loudness..well several others, no md5 though
 
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 28, 2014, 05:30:12 pm
Run with -d -v and you'll see output like:

    read_config_file    : scriptlet AcousticFingerprint option field: audio_md5 ==> 'EN MD5'
    ...
    do_perfile          : Key/Value: audio_md5 = 89ddebea3ac60fb73c55d905cb81eb63
    ...
    new(EN MD5): 89ddebea3ac60fb73c55d905cb81eb63

The first one indicates the mapping from the config file.  This shows your field name.

The second one shows you the returned value.

The third one shows you the value assigned to your field.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: winniew on March 29, 2014, 04:37:03 am
Here I am again with Scriptlet GetCoverArtSize.
I have a strange issue with filenames containing french accents (for instance accent aigu).

Here copy-pasted from the command shell:
Code: [Select]
C:\Users\Winnie\Desktop\Pscriptor109>perl pscriptor.pl -v -t -c pscriptor-config.txt -f "WW_CoverArtSize" -E GetCoverArtSize -a WW_Image_File_Width,WW_Image_File_Height
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\04 - PrÚlude Ó l¦aprÞs-midi d¦un faune.mp3
        in(ww_coverartsize): ''
        old=new(ww_coverartsize): <unknown>     field(ww_coverartsize) UNCHANGED: null value returned from script

Copy-pasting the field "Filename" directly from MC19.124 I get this (looks OK):
Code: [Select]
E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\04 - Prélude à l´après-midi d´un faune.mp3
I think it's something with encoding the clipboard, but I have absolutely no idea.
I am working on Windows7 64Bit German.


Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 29, 2014, 10:38:01 pm
I have a strange issue with filenames containing french accents (for instance accent aigu).
   ...
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\04 - PrÚlude Ó l¦aprÞs-midi d¦un faune.mp3
   ...
Copy-pasting the field "Filename" directly from MC19.124 I get this (looks OK):

E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\04 - Prélude à l´après-midi d´un faune.mp3

I figured out what was causing this, and have solved the problem, but the solution leads to yet another issue for which I'm trying to find an optimal solution.

Technical FYI: The clipboard data is fine.  The problem is elsewhere, and is tricky.  It reared its head due to this scriptlet spawning a sub-process and needing to deliver a file path to a Windows binary.  The Perl-to-Windows bridge in ActivePerl has to convert internal Perl character representations into a byte sequence suitable for Windows, but there are cases where the automatic conversion cannot map correctly (due to implementation choices made for backwards compatibility reasons).  So I have to force the bridge into UTF-8 mode and force a wide-string (Variant BSTR) across the bridge.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: winniew on March 30, 2014, 02:59:10 am
I figured out what was causing this, and have solved the problem, but the solution leads to yet another issue for which I'm trying to find an optimal solution.
..
Thanks, there is no hurry. I will be patient.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on March 30, 2014, 09:03:21 am
[Edit: I fixed your link]

Mr. C is there a way to make things better with regard to my issue here, that is ..could a scriptlet be made to improve the random sampling of tracks>

http://yabb.jriver.com/interact/index.php?topic=88428.0 (http://yabb.jriver.com/interact/index.php?topic=88428.0)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 30, 2014, 10:33:48 pm
Mr. C is there a way to make things better with regard to my issue here, that is ..could a scriptlet be made to improve the random sampling of tracks>

Sure, I suppose it could create a random playlist of size N and play that.  You want a random ordering of the tracks, and then selecting N of them?

I'm concerned about the amount of files you'll be throwing at it.  45,000 files is a lot of stuff to place on the clipboard, and I've not tested pscriptor with anything that large.  I suppose you could make a view with just the Filename field in it, and that will certain reduce the load.

I'll take a look at this sometime in the next day or two; I'll probably base it off the existing MakePlaylist scriptlet, and just drop the playlist to your desktop (and it could cause MC to start playback of that playlist too I suppose).
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 31, 2014, 12:12:13 am
Thanks, there is no hurry. I will be patient.

Ok, good news.  My 18000+ file test passed, so I'll post an update tomorrow.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on March 31, 2014, 02:22:50 am
Sure, I suppose it could create a random playlist of size N and play that.  You want a random ordering of the tracks, and then selecting N of them?

I'm concerned about the amount of files you'll be throwing at it.  45,000 files is a lot of stuff to place on the clipboard, and I've not tested pscriptor with anything that large.  I suppose you could make a view with just the Filename field in it, and that will certain reduce the load.

I'll take a look at this sometime in the next day or two; I'll probably base it off the existing MakePlaylist scriptlet, and just drop the playlist to your desktop (and it could cause MC to start playback of that playlist too I suppose).


yes sir, that would be perfect.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on March 31, 2014, 03:20:48 am
Run with -d -v and you'll see output like:

    read_config_file    : scriptlet AcousticFingerprint option field: audio_md5 ==> 'EN MD5'
    ...
    do_perfile          : Key/Value: audio_md5 = 89ddebea3ac60fb73c55d905cb81eb63
    ...
    new(EN MD5): 89ddebea3ac60fb73c55d905cb81eb63

The first one indicates the mapping from the config file.  This shows your field name.

The second one shows you the returned value.

The third one shows you the value assigned to your field.



well, i see an md5 value in the command shell output,.  but when it finishes there is no value displayed in the MC field. i should see that checksum string just like id see the name, album, etc right? im sorry to be so slow MrC
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 31, 2014, 10:51:11 am

well, i see an md5 value in the command shell output,.  but when it finishes there is no value displayed in the MC field. i should see that checksum string just like id see the name, album, etc right? im sorry to be so slow MrC

If the field is not being written to your Library, then it means the field name is not the same as the field specified in the config file (very that in from the output).
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: winniew on March 31, 2014, 01:20:36 pm
Ok, good news.  My 18000+ file test passed, so I'll post an update tomorrow.
Cool.
..
So I am looking for my own testcases to validate your coming update.

One problem feeds the next: I am trying to find all my files with "Filename contains character à".

Search-Wizard-Rule
(http://image-upload.de/image/XYKQKH/bab44fd61f.png)
show 90% of my library, this is definitively wrong.
Not really intuitive. What am I doing wrong (again)?

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on March 31, 2014, 06:13:27 pm
I've posted version 1.10.  It includes the Numberize and MakeRandomPlaylist scriptlets, and should also resolve the problem with Unicode characters in the AcousticFingerprint scriptlet.

Version 1.10
    - Fix: a script return value of 0 was not updating a cell.
    - New: scriptlet Numberize will return a numerical sequence on a per-group basis.  See the
      comments in the scriptlet for usage.
    - New: scriptlet MakeRandomPlaylist will select N random tracks from the selected files for
      more randomness of playback than MC provides.  Will also auto-start playback by default.
      See the comments in the scriptlet for more info.
    - Fix: scriptlet AcousticFingerprint failed on some Unicode file names.
    - Internal: Use common MCUilts clipboard read/parsing.
    - Internal: the 'perfile' scriptlet callback may be set to undef if no per-file work is required.

@theoctavist - please give the MakeRandomPlaylist scriptlet a trial.  If you are going to select all of your 45k tracks, it would be more efficient of you create a new view or smartlist that only includes the Filename column (so that less is posted to the clipboard).  Example usage, picking 100 random tracks from the selecting and playing them back in zone 2.

    perl pscriptor.pl -c pscriptor-config.txt -E MakeRandomPlaylist -a "n=100 zone=2"

@winniew - please test to see if this update resolves the AcousticFingerprint filename issues you had.

One problem feeds the next: I am trying to find all my files with "Filename contains character à".
...
Not really intuitive. What am I doing wrong (again)?

The problem is that MC is automatically ASCII-fying your characters, since most people want that behavior with Search.

Try typing this into the Search box:

   [=regex([filename],/#[é]#/)]=1

You can add characters inside the [ ] brackets - any of them will be matched.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: winniew on April 01, 2014, 09:31:25 am
I have just tried the new version 1.10 with GetCoverArtSize and my Ravel-Testfiles.
With empty sizefields I get the following:
Code: [Select]
C:\Users\Winnie\Desktop\Pscriptor110>perl pscriptor.pl -v -c pscriptor-config.txt -f "WW_CoverArtSize" -E GetCoverArtSize -a WW_Image_File_Width,WW_Image_File_Height
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\03 - Clair de lune.mp3
        in(ww_coverartsize): ''
        new(ww_image_file_height): 511
        new(ww_image_file_width): 344
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\04 - Pr+®lude +á l-¦apr+¿s-midi d-¦un faune.mp3
        in(ww_coverartsize): ''
        old=new(ww_coverartsize): <unknown>     field(ww_coverartsize) UNCHANGED: null value returned from script
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\05 - La Mer I. De l'aube +á midi sur la mer.mp3
        in(ww_coverartsize): ''
        old=new(ww_coverartsize): <unknown>     field(ww_coverartsize) UNCHANGED: null value returned from script

First file is OK but again the files with the french accents don't work for me. Sorry.

I will send you a PM with a link to my problemfile.

The regex in the Search box works perfect, that would have taken me hours.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 01, 2014, 10:45:51 am
I have just tried the new version 1.10 with GetCoverArtSize and my Ravel-Testfiles.
With empty sizefields I get the following:
Code: [Select]
C:\Users\Winnie\Desktop\Pscriptor110>perl pscriptor.pl -v -c pscriptor-config.txt -f "WW_CoverArtSize" -E GetCoverArtSize -a WW_Image_File_Width,WW_Image_File_Height
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\03 - Clair de lune.mp3
        in(ww_coverartsize): ''
        new(ww_image_file_height): 511
        new(ww_image_file_width): 344
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\04 - Pr+®lude +á l-¦apr+¿s-midi d-¦un faune.mp3
        in(ww_coverartsize): ''
        old=new(ww_coverartsize): <unknown>     field(ww_coverartsize) UNCHANGED: null value returned from script
File: E:\mp3_rw_2009\(Multiple Artists)\Ravel - Bolero\05 - La Mer I. De l'aube +á midi sur la mer.mp3
        in(ww_coverartsize): ''
        old=new(ww_coverartsize): <unknown>     field(ww_coverartsize) UNCHANGED: null value returned from script

First file is OK but again the files with the french accents don't work for me. Sorry.

Oh, I'm a doof.  Of course it won't work any better.  I updated the AcousticFingerprint scriptlet, not the GetCoverArtSize scriptlet!  Somehow i started using that script for testing the problem and had forgotten entirely that you were using the other one.   I'll make the changes today.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 01, 2014, 11:11:20 am
@ winniew - please test the attached version of the scriptlet.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: winniew on April 01, 2014, 12:06:51 pm
Perfect, now GetCoverArtSize works, even with my worstcase-filename:
"04 - Prélude à l´après-midi d´un faune_áàéè_äÄöÜß_°^§$%&#€.mp3"

Thank you for quick help!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 01, 2014, 12:10:39 pm
You're welcome, and I'm really sorry about the time this took.  This is one of those weak areas with ActiveState's ActivePerl; they chose to be incompatible for ease of use for most users years ago, and that decision in certain areas has created issues (other perl versions do not suffer these limitations).  I also didn't realize that the Image module I use would botch the filenames too under ActivePerl.

Thanks for your patience.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 02, 2014, 01:01:04 pm
I've posted pscriptor version 1.11.  The new WhichPlaylists scriptlet allows retrieving the list of all playlists that a file resides in.  See the comments in the scriptlet.

Version 1.11
    - Fix: scriptlet GetCoverArtSize failed on some Unicode file names.
    - Change: Sample scriptlets renamed with leading underscore (helps filename autocompletion
      and sorting).
    - New: scriptlet WhichPlaylists returns a list of every playlist that a file exists in.  The
      fullpath of the playlist is returned, suitable for use in building paths, etc.
    - Change: obsoleted scriptlet CopyPlaylistName, which could only copy the name (not path) of
      a playlist, and therefore had limited utility.  See WhichPlaylists above for superior
      functionality.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on April 03, 2014, 05:02:39 am
I've posted version 1.10.  It includes the Numberize and MakeRandomPlaylist scriptlets, and should also resolve the problem with Unicode characters in the AcousticFingerprint scriptlet.

Version 1.10
    - Fix: a script return value of 0 was not updating a cell.
    - New: scriptlet Numberize will return a numerical sequence on a per-group basis.  See the
      comments in the scriptlet for usage.
    - New: scriptlet MakeRandomPlaylist will select N random tracks from the selected files for
      more randomness of playback than MC provides.  Will also auto-start playback by default.
      See the comments in the scriptlet for more info.
    - Fix: scriptlet AcousticFingerprint failed on some Unicode file names.
    - Internal: Use common MCUilts clipboard read/parsing.
    - Internal: the 'perfile' scriptlet callback may be set to undef if no per-file work is required.

@theoctavist - please give the MakeRandomPlaylist scriptlet a trial.  If you are going to select all of your 45k tracks, it would be more efficient of you create a new view or smartlist that only includes the Filename column (so that less is posted to the clipboard).  Example usage, picking 100 random tracks from the selecting and playing them back in zone 2.

    perl pscriptor.pl -c pscriptor-config.txt -E MakeRandomPlaylist -a "n=100 zone=2"

@winniew - please test to see if this update resolves the AcousticFingerprint filename issues you had.

The problem is that MC is automatically ASCII-fying your characters, since most people want that behavior with Search.

Try typing this into the Search box:

   [=regex([filename],/#[é]#/)]=1

You can add characters inside the [ ] brackets - any of them will be matched.


im getting there.

ok, lets say i dont want to change the default...i just want to always select all the audio files and start the playback immediately.

I have on one of my drives... 23,638 files. just want to play them , not worry about zones, or specific path to put the playlist in. 

how would I type it out?  i mean what would come after this...
perl pscriptor.pl -c pscriptor-config.txt -E MakeRandomPlaylist  -a n=23638

is that right or? again, just want to autoplay all random all the time, to include all the audio tracks I have.

im terribly slow with all this code stuff.

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on April 03, 2014, 06:06:37 am
I've posted pscriptor version 1.11.  The new WhichPlaylists scriptlet allows retrieving the list of all playlists that a file resides in.  See the comments in the scriptlet.


    - New: scriptlet WhichPlaylists returns a list of every playlist that a file exists in.  The
      fullpath of the playlist is returned, suitable for use in building paths, etc.
    - Change: obsoleted scriptlet CopyPlaylistName, which could only copy the name (not path) of
      a playlist, and therefore had limited utility.  See WhichPlaylists above for superior
      functionality.

Could you give me a sample command to test it? Can we now merge the playlists at the 'Playlists field' of each track?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 03, 2014, 10:58:24 am
I have on one of my drives... 23,638 files. just want to play them , not worry about zones, or specific path to put the playlist in. 

how would I type it out?  i mean what would come after this...

You have it right, but it is even simpler.  Select all your files and enter the command:

   perl pscriptor.pl -c pscriptor-config.txt -E MakeRandomPlaylist

Could you give me a sample command to test it? Can we now merge the playlists at the 'Playlists field' of each track?

   perl -c pscriptor-config.txt -E WhichPlaylists -f some_field

where some_field is the name of the field you want to be the target of the list of playlist paths. WhichPlaylists will place in that field all the full paths of each playlist that includes the file (Smartllsts are omitted).   MC's Playlist file list column is not used.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: theoctavist on April 04, 2014, 01:29:12 am
You have it right, but it is even simpler.  Select all your files and enter the command:

   perl pscriptor.pl -c pscriptor-config.txt -E MakeRandomPlaylist

   perl -c pscriptor-config.txt -E WhichPlaylists -f some_field

where some_field is the name of the field you want to be the target of the list of playlist paths. WhichPlaylists will place in that field all the full paths of each playlist that includes the file (Smartllsts are omitted).   MC's Playlist file list column is not used.

it works fantastically well!! AWESOME! thank you so much! used with 23,832 files today.  (One of my music drives)

so happy! the random before has nothing on this.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 20, 2014, 06:04:00 pm
I've posted version 1.12, which fixes a few issues and adds a new scriptlet TestFile which will test/verify some media files.

Version 1.12
    - New: scriptlet FileTest verifies media files.  See scriptlet for supported file types and
      instructions.  More file types will be added as requested (and as verification tools are
      shown to be reliable).
    - Fix: missing -f is now reported instead of silently doing nothing.
    - Fix: several fixes for scriptlets GetCoverArtInfo and AcousticFingerprint: 1. conditionally
      use Win32 on Win32 platforms; 2. failure to use the non-ansi filename when an ANSI filename
      was unavailable;  3. failure to increment a file count used for debugging.
    - Fix: GetCoverArtInfo debug message used quotes ' instead of ", preventing interpolation.

The TestFile scriptlet currently supports file types of flac and m4a.  See the scriptlet for installation instructions.  Example usage:

   perl pscriptor.pl -c pscriptor-config.txt  -E TestFile -f comment

where any failed results of the test will be placed in the Comment field.  Unsupported file types will be ignored, and successful verification will not write any results to the Comment field.

See also:

   http://yabb.jriver.com/interact/index.php?topic=88717.0 (http://yabb.jriver.com/interact/index.php?topic=88717.0)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on April 27, 2014, 09:26:25 am
Hello MrC,

I am trying to run WhichPlaylists and I get this error



perl pscriptor.pl -c pscriptor-config.txt -E WhichPlaylists -f Playlists_Paths
Uncaught exception from user code:
        send_items: MCWS write failed:
        http://localhost:52199/MCWS/v1/File/SetInfo?Value=%20-%20Tango%5C%20-%20Milongas%20Cl%5CC.%20Modern%20*%5CSassone%20Florindo%20%20St%5CTango%20(1)%5CMedium%5CDramatic&Field=playlists_paths&FileType=Filename&File=(Install%20Drive)%3A%5Ct%5Cmus
ic%5Cfiloi%5C2%5CFlorindo%20Sassone%20-%20214%20Registros%5CFlorindo%20Sassone-Viruta.wav
        500 Internal server error
        <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
        <Response Status="Failure"/>
        MCUtils::MCWS::send_items('MCUtils::MCWS=HASH(0x243a60c)', 'REF(0x243501c)') called at MCUtils/MCWS.pm line 55
        MCUtils::MCWS::send('MCUtils::MCWS=HASH(0x243a60c)', 'ARRAY(0x24373f4)') called at pscriptor.pl line 155


Is there something that I am doing wrong?

Thanks

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 27, 2014, 11:47:44 am
The error is:

  send_items: MCWS write failed:

so this indicates that MCWS doesn't like the URL for some reason.    I tried the same URL, but with a different file name, C:\1.mp3 and this worked.  Then I tried a WAV file with C:\1.wav, and that worked.

So the problem is likely something else about your path that MCWS doesn't like, probably the (Install Drive):\ part, but I'm not sure.  I'm not setup here to test a portable installation to see how MC handles that.  Have you successfully used pscriptor with other paths on (Install Drive):\ before?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: arin on April 27, 2014, 12:33:11 pm
Sorry to bother you MrC,
but I'm trying to get pscriptor running on mac and I got some problems 'caused, I think, about missing resources.
I've tried to install ActivePerl for mac but it didn't solve the problem.

Could you guide me to install everything pscriptor requires to run on mac?


Thanx a lot!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 27, 2014, 12:48:00 pm
Ok, great question, and I knew someday, someone would ask.

I'll state up front, some will find this too much trouble...

First, I've never used ActivePerl on the Mac (in fact, I can think there are some cases where ActivePerl may not work with pscriptor and other Perl scripts I've created).  There's no reason too, as OS X includes Perl (and I will spend no time working out issues with ActivePerl on the Mac).  The only thing you'll be missing are some of the CPAN modules that pscriptor and the scriptlets use.  So these have to be installed.

Now, there are a couple of ways to install modules, often times they are trivial, but require OS X development tools such as a compiler, and this part is the drag... because it drags in some large binaries which you're likely to never use.  And building CPAN modules leaves users lost when the build fails.

So the better approach is to use pre-built and pre-tested tool environments.  There are two external tool kits that many folks use when they want to add additional tools to their OS X system.  Folks pick one or the other, whichever suits their needs/tastes (I use MacPorts):

   MacPorts: https://www.macports.org/
   Fink: http://www.finkproject.org/

There is also the BSD ports collection, but I won't suggest that, as it is more complicated than most uses will want to deal with.

With either of the above, you'll need to install:

   - Apple's Xcode
   - Apple's Command Line Developer Tools (can be installed via Xcode above)

This will use a few gigabytes of your disk.

I'll continue describing more if you are still interested...  
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on April 27, 2014, 04:00:58 pm
The error is:

  send_items: MCWS write failed:

so this indicates that MCWS doesn't like the URL for some reason.    I tried the same URL, but with a different file name, C:\1.mp3 and this worked.  Then I tried a WAV file with C:\1.wav, and that worked.

So the problem is likely something else about your path that MCWS doesn't like, probably the (Install Drive):\ part, but I'm not sure.  I'm not setup here to test a portable installation to see how MC handles that.  Have you successfully used pscriptor with other paths on (Install Drive):\ before?



I think that it had worked well previouslly with (install drive) paths, but I can't be totally sure.

I tried the DateParse script with another file which doesn't have the (install drive) path but got similar results. I checked and the file is not "read only".


perl pscriptor.pl -v -c pscriptor-config.txt -E DateParse -f "Filename (name)"::Date_Recorded
File: X:\t\2. Epoca de Oro\Alfredo De ├Βngelis\Cantores\Juan Carlos Godoy\Entre tu amor y mi amor(J.Pomati,L.D.V├σlez) - De ├Βngelis, J.C.Godoy [18.8.1959].mp3
DateParse: parse_format error: Date not fully specified
        in(filename (name)): 'Entre tu amor y mi amor(J.Pomati,L.D.V├σlez) - De ├Βngelis, J.C.Godoy [18.8.1959].mp3'
        old(date_recorded): ''
        new(date_recorded): '1959'
Uncaught exception from user code:
        send_items: MCWS write failed:
        http://localhost:52199/MCWS/v1/File/SetInfo?Value=1959&Field=date_recorded&FileType=Filename&File=X%3A%5Ct%5Cmusic%5Cfiloi%5CTango%20Mike%5C2.%20Epoca%20de%20Oro%5CAlfredo%20De%20%C3%81ngelis%5CCantores%5CJuan%20Carlos%20Godoy%5CEntre%20tu%20
amor%20y%20mi%20amor(J.Pomati%2CL.D.V%C3%A9lez)%20-%20De%20%C3%81ngelis%2C%20J.C.Godoy%20%5B18.8.1959%5D.mp3
        500 Internal server error
        <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
        <Response Status="Failure"/>
        MCUtils::MCWS::send_items('MCUtils::MCWS=HASH(0x22fa12c)', 'REF(0x340232c)') called at MCUtils/MCWS.pm line 55
        MCUtils::MCWS::send('MCUtils::MCWS=HASH(0x22fa12c)', 'ARRAY(0x22f6f04)') called at pscriptor.pl line 155


When running the WhichPlaylists script for this file it just doesn't return any results or errors.
I added "-v" and I got "Null value returned from script", although I can see that the file is in playlists.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: arin on April 27, 2014, 04:14:05 pm
Thank you!
I installed Xcode before I had a try with ActivePerl; I thought ActivePerl could help me getting the missing resources...
In the next days I'll try installing MacPorts and the Command Line Developer Tools...hoping not to drown in all this code! ;)
In that case I'll ask you for some more help.

In the meantime if you've got some more pearls about perl you could share with a complete dumb newbie, you're really very welcome!!!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 27, 2014, 04:19:10 pm
This time you got a different error:

   DateParse: parse_format error: Date not fully specified

The reason for this is that your dates are using . (dot) as a separator and not - (dash), and I intentionally am only checking for dash to minimize chances for incorrect date matching.

Also, there is no pattern in the script to detect for the dd-m-yyyy in any case, which you can add to the @date_formats array, somewhere near the top:

        '(?:^|\D)%d-%f-%Y(?:\D|$)', # DD-M-YYYY

If you'd like, I can make the date separator configurable, or you can use an expression column now to replace dot with dash:

   replace([filename (name)], ., -)

and use the expression column as the input field.

To test against your (install path) file, you might test with a simpler, surer scriptlet such as NameCase.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 27, 2014, 04:37:34 pm
Thank you!
I installed Xcode before I had a try with ActivePerl; I thought ActivePerl could help me getting the missing resources...
In the next days I'll try installing MacPorts and the Command Line Developer Tools...hoping not to drown in all this code! ;)
In that case I'll ask you for some more help.

In the meantime if you've got some more pearls about perl you could share with a complete dumb newbie, you're really very welcome!!!

Great, and You're Welcome.

Be sure to follow the instructions @ MacPorts, items 1 through 3 mentioned under Quickstart, which are expanded further under Installing MacPorts items numbered 1, 2, and 3:

   https://www.macports.org/install.php

You'll want to install from the pkg format for your version of OS X.

Once you have that working, you'll want to use the perl installed in:

   /opt/local/bin

but I believe MacPorts will adjust your path, so just start a new Terminal shell and type:

   which perl

to be sure.

After that, its just a matter of installing the modules required by pscriptor or any scriptlet.  You just run pscriptor with any given scriptlet, and you'll see a failure sure as:

   Can't locate XML/LibXML.pm in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.16.3/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.16.3...

The missing module is listed as a path "XML/LibXML.pm", and you'll mentally convert this to:

   xml-libxml

and you'll ask the ports command to install it for you by name.  Finding the name:

   port list | grep p5.16 | grep -i xml-libxml

   $ port list | grep p5.16 | grep -i xml-libxml
   p5.16-xml-libxml                   @1.840.0        perl/p5-xml-libxml
   p5.16-xml-libxml-simple        @0.930.0        perl/p5-xml-libxml-simple

and to install the module:

   sudo port install p5.16-xml-libxml

Repeat for any missing modules.

Also, be sure to uninstall ActivePerl for Mac OS X.  I don't know what their un-install procedure is, so you might want to check that out in case there is anything special required.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: arin on April 28, 2014, 07:55:21 am
Ok MrC…here I am again!
I've installed everything following every instruction and after having unistalled ActivePerl.
No errors at all…

And when I try to run TestFile via pscriptor, after having selected some m4a audio files in MC, I get this:

Can't locate Text/CSV.pm in @INC (@INC contains: /Library/Perl/5.16/darwin-thread-multi-2level /Library/Perl/5.16 /Network/Library/Perl/5.16/darwin-thread-multi-2level /Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.2 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16 /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level /System/Library/Perl/Extras/5.16 .) at desktop/pscriptor.pl line 19.
BEGIN failed--compilation aborted at desktop/pscriptor.pl line 19 (#1)
    (F) You said to do (or require, or use) a file that couldn't be found.
    Perl looks for the file in all the locations mentioned in @INC, unless
    the file name included the full path to the file.  Perhaps you need
    to set the PERL5LIB or PERL5OPT environment variable to say where the
    extra library is, or maybe the script needs to add the library name
    to @INC.  Or maybe you just misspelled the name of the file.  See
    "require" in perlfunc and lib.
   
Uncaught exception from user code:
   Can't locate Text/CSV.pm in @INC (@INC contains: /Library/Perl/5.16/darwin-thread-multi-2level /Library/Perl/5.16 /Network/Library/Perl/5.16/darwin-thread-multi-2level /Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.2 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16 /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level /System/Library/Perl/Extras/5.16 .) at desktop/pscriptor.pl line 19.
   BEGIN failed--compilation aborted at desktop/pscriptor.pl line 19.



Then I tried to do this:

port list | grep p5.16 | grep -i Text-CSV


Followed by this:

sudo port install p5.16-text-csv


And I got this:

--->  Computing dependencies for p5.16-text-csv
--->  Dependencies to be installed: perl5.16 gdbm gettext expat libiconv ncurses
--->  Fetching archive for expat
--->  Attempting to fetch expat-2.1.0_0.darwin_13.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/expat
--->  Attempting to fetch expat-2.1.0_0.darwin_13.x86_64.tbz2.rmd160 from http://nue.de.packages.macports.org/macports/packages/expat
--->  Installing expat @2.1.0_0
--->  Activating expat @2.1.0_0
--->  Cleaning expat
--->  Fetching archive for libiconv
--->  Attempting to fetch libiconv-1.14_0.darwin_13.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/libiconv
--->  Attempting to fetch libiconv-1.14_0.darwin_13.x86_64.tbz2.rmd160 from http://nue.de.packages.macports.org/macports/packages/libiconv
--->  Installing libiconv @1.14_0
--->  Activating libiconv @1.14_0
--->  Cleaning libiconv
--->  Fetching archive for ncurses
--->  Attempting to fetch ncurses-5.9_2.darwin_13.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/ncurses
--->  Attempting to fetch ncurses-5.9_2.darwin_13.x86_64.tbz2.rmd160 from http://nue.de.packages.macports.org/macports/packages/ncurses
--->  Installing ncurses @5.9_2
--->  Activating ncurses @5.9_2
--->  Cleaning ncurses
--->  Fetching archive for gettext
--->  Attempting to fetch gettext-0.18.3.2_0.darwin_13.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/gettext
--->  Attempting to fetch gettext-0.18.3.2_0.darwin_13.x86_64.tbz2.rmd160 from http://nue.de.packages.macports.org/macports/packages/gettext
--->  Installing gettext @0.18.3.2_0
--->  Activating gettext @0.18.3.2_0
--->  Cleaning gettext
--->  Fetching archive for gdbm
--->  Attempting to fetch gdbm-1.11_0.darwin_13.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/gdbm
--->  Attempting to fetch gdbm-1.11_0.darwin_13.x86_64.tbz2.rmd160 from http://nue.de.packages.macports.org/macports/packages/gdbm
--->  Installing gdbm @1.11_0
--->  Activating gdbm @1.11_0
--->  Cleaning gdbm
--->  Fetching archive for perl5.16
--->  Attempting to fetch perl5.16-5.16.3_0.darwin_13.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/perl5.16
--->  Attempting to fetch perl5.16-5.16.3_0.darwin_13.x86_64.tbz2.rmd160 from http://nue.de.packages.macports.org/macports/packages/perl5.16
--->  Installing perl5.16 @5.16.3_0
--->  Activating perl5.16 @5.16.3_0
--->  Cleaning perl5.16
--->  Fetching archive for p5.16-text-csv
--->  Attempting to fetch p5.16-text-csv-1.210.0_3.darwin_13.noarch.tbz2 from http://nue.de.packages.macports.org/macports/packages/p5.16-text-csv
--->  Attempting to fetch p5.16-text-csv-1.210.0_3.darwin_13.noarch.tbz2.rmd160 from http://nue.de.packages.macports.org/macports/packages/p5.16-text-csv
--->  Installing p5.16-text-csv @1.210.0_3
--->  Activating p5.16-text-csv @1.210.0_3
--->  Cleaning p5.16-text-csv
--->  Updating database of binaries: 100.0%
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.


Then I rerun TestFile via pscriptor and got this:

Can't locate Text/CSV.pm in @INC (@INC contains: /Library/Perl/5.16/darwin-thread-multi-2level /Library/Perl/5.16 /Network/Library/Perl/5.16/darwin-thread-multi-2level /Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.2 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16 /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level /System/Library/Perl/Extras/5.16 .) at desktop/pscriptor.pl line 19.
BEGIN failed--compilation aborted at desktop/pscriptor.pl line 19 (#1)
    (F) You said to do (or require, or use) a file that couldn't be found.
    Perl looks for the file in all the locations mentioned in @INC, unless
    the file name included the full path to the file.  Perhaps you need
    to set the PERL5LIB or PERL5OPT environment variable to say where the
    extra library is, or maybe the script needs to add the library name
    to @INC.  Or maybe you just misspelled the name of the file.  See
    "require" in perlfunc and lib.
   
Uncaught exception from user code:
   Can't locate Text/CSV.pm in @INC (@INC contains: /Library/Perl/5.16/darwin-thread-multi-2level /Library/Perl/5.16 /Network/Library/Perl/5.16/darwin-thread-multi-2level /Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.2 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16 /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level /System/Library/Perl/Extras/5.16 .) at desktop/pscriptor.pl line 19.
   BEGIN failed--compilation aborted at desktop/pscriptor.pl line 19.


Any new suggestions?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 28, 2014, 11:33:02 am
The @INC path in the error message from perl shows that the OS X version of perl is being used, not the new /opt/local/bin version you installed via Mac Ports.

Try looking at the PATH environment variable:

   echo $PATH

Code: [Select]
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/Users/MrC/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

and if /opt/local/bin is not at the front of the PATH, that's the cause.  Did you start up and use a new Terminal window (new shell) after installing the MacPorts package?  (see my above message about this).  MacPorts will add this entry:

Code: [Select]
# MacPorts Installer addition on 2013-04-06_at_09:45:09: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

to your .bash_profile.  Having the PATH set properly means you don't have to type full path names to the executables in /opt/local/bin:

   /opt/local/bin/perl pscriptor.pl ....

and instead can use:

   perl pscriptor.pl ....

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on April 29, 2014, 02:59:55 pm
I recall some folks in the past have asked about extracting embedded cover art.

So I've written a scriptlet to extract embedded cover art from audio files.  It currently places the artwork in the same folder as the audio file, using the name prefix "coverart" and with the proper suffix given the file type.  The name prefix can also be user-specified.  Examples:

  coverart.png
  Folder.jpg

Most album's tracks will have the same cover art.  So I'm wondering if it is OK to leave as a limitation that a user must filter all but one track from albums.  The scriptlet would then only pull cover art for one file / per album (i.e. the files in the view), and this would be much faster to process.  There would be no harm in leaving all the files in the view, the file will just get created over and over, once for each track.

For the cases where there is unique per-track cover art in an album, would it be sufficient to prefix the given file names with the disc/track number?  Examples:

  1 coverart.jpg
  1-2 Folder.jpg

I could also use the track's Name, or really any field in the view (including your own expression field).  But I have to be careful about path length limitations.  Suggestions?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 02, 2014, 12:05:27 am
Hello MrC,

do you think you can add a script that extracts  a playlist (as m3u8) to a pre-specified folder copying the files alongside with the playlist?

Thank you
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 02, 2014, 12:11:01 am
Sure.  I'll take a look tomorrow.

Where will the playlist come from?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 02, 2014, 12:38:24 am
From MC.

I have some playlists that I want to give to some friends of mine (together with the songs) or even take them with me at my android or USB stick, but since many of my songs have Spanish characters I can't do that through "handheld devices" in MC.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 02, 2014, 12:41:26 am
Ok, so it will work based on the selection of files.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 02, 2014, 12:45:33 am
Yes, thank you  :) Can it also work based on the selection of playlists?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 02, 2014, 01:02:46 am
Pscriptor has no access to those as a selection.  It gets it's data from the clipboard, and the selected playlist names won't be there.  Only the view's file list data is available, so that means the file list files must be selected.  However, if the view contained the Playlist column, and it's value was meaningful for grouping, then it might be used to create these virtual groups.  I'm not sure the playlist's file ordered would be retained.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 02, 2014, 01:08:31 am
OK we can check and see how it goes. I think it will be faster to reorganize the file order in a program, than find each link in a m3u playlist that has a special character and correct it (this is what I have to do now each time I extract the playlist with the files through MC).
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 02, 2014, 03:05:06 pm
@stiv32 - I'm thinking about how i want to implement the Copy and Make M3U8 playlist feature.

I'll need to know how you'll want to deal with directories.  You can supply a Base path, and I'll have existing file paths, but I'd like to know your requirements for how to build up the final destination path.  Example:

   M:\Music\Philip Glass\Koyaanisqatsi\03 Clouds.flac

it could work such that a certain pattern should be removed from the front, replacing it with some replacement value, as in:

   M:\Music ==> Z:\Copied Files

leaving you with:

   Z:\Copied Files\Philip Glass\Koyaanisqatsi\03 Clouds.flac

And/or it could work by using only the file name, placing the files in some single specified directory:

  Z:\Some Base Directory\03 Clouds.flac

Or it could work based on some expression field you have in the view.

Thoughts?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 02, 2014, 03:22:08 pm

Could we use for the songs; paths relative to the playlist?

In that way I could point where the playlist will be created/extracted (i.e. z:/music/) and the files can either be copied in a folder there (../songs) or they can be copied to the path ../[artist]/song.mp3.

 
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 02, 2014, 04:25:32 pm
Sure, but you need to think about how you want to handle collisions.  If I copy these two files:

   M:\Music\<various artists>\A Very Special Christmas\01 I Saw Three Ships.flac
   M:\Music\Mannheim Steamroller\Christmas 1984\01 I Saw Three Ships.flac

Then we get identical files at the same location:

    Z:\Music\<playlist name>\01 I Saw Three Ships.flac

So I have to start testing:

   - Does the file exist?
      - Yes, derive a new name and repeat the process...

Since by definition your existing file paths don't have collisions, using the existing hierarchy makes the job easier.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 02, 2014, 04:36:05 pm
That means that we could copy the existing file paths and make them relative to the playlist, right?

One thing that might go wrong here is the length of those paths when we add them to the playlist folder. If we get the whole link of each track we might end up with more than 256 characters per path.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 02, 2014, 04:43:30 pm
That's the idea, but you're saying it backwards.  The new M3U8 playlist entries will either be absolute paths, or can be relative paths.  If relative, the new playlist can be located anywhere in the new path tree, so long as its entries are valid.

I've been presuming you want:

   Z:\Music\<playlist name>
   Z:\Music\<playlist name>\playlist.m3u
   Z:\Music\<playlist name>\folders\files

so the m3u8 paths will be either of:

     Z:\Music\<playlist name>\folders\files
     .\folders\files  (with or without the .\ prepended)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 02, 2014, 04:51:49 pm
Do we need the "Z:\Music" path?

I mean that if the positions of the files and playlist are relative to each other, wherever we place the folder containing them should be fine, right?

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 02, 2014, 04:54:14 pm
I should have just said <basepath> which could be an absolute or relative path to a folder.

The problem with relative paths... what will it be relative to?  If you just say "folderX", where is folderX from pscriptor's or MC's point of view?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 02, 2014, 09:22:31 pm
Ok, I have the basic script done, and have named it in your honor, for now anyway.  :)   It is called Stig32inator.

It uses the field supplied in -f as the grouping field.  This might be, for example, the Playlists column, a value from the Comment field, or whatever.  It uses an argument supplied by -a as the destination base path (where the new files will be located.  e.g. -a 'path=Z:').

For each grouping:
   - it creates an m3u8 playlist containing a list of the files in that grouping  
   - it copies the original file to a location specified by the -a supplied base path

To make sure it meets your Unicode needs, I've verified the name in the playlist and file copied using the filename:

      Prélude à l´après-midi d´un faune.mp3

Now, we just have to decide how you want to handle any sub directories for tracks.  Right now, if you had two playlists names as the groupings, the scriptlet would create:

   Z:\playlist1.m3u8
   Z:\file1_in_playlist1
   Z:\file2_in_playlist1
   Z:\playlist2.m3u8
   Z:\file1_in_playlist2
   Z:\file2_in_playlist2

Maybe you want them like this, however:

   Z:\playlist1
   Z:\playlist1\playlist1.m3u8
   Z:\playlist1\file1_in_playlist1
   Z:\playlist1\file2_in_playlist1
   Z:\playlist2
   Z:\playlist2\playlist2.m3u8
   Z:\playlist2\file1_in_playlist2
   Z:\playlist2\file2_in_playlist2

or even (note the generic playlist name "playlist.m3u8"):

   Z:\playlist1
   Z:\playlist1\playlist.m3u8
   Z:\playlist1\file1_in_playlist1
   Z:\playlist1\file2_in_playlist1
   Z:\playlist2
   Z:\playlist2\playlist.m3u8
   Z:\playlist2\file1_in_playlist2
   Z:\playlist2\file2_in_playlist2

 Also, how do you want to handle existing files?  Overwrite them?  Abort the copy for that file?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 02, 2014, 11:36:33 pm
Thank you very much for the honor MrC  :D


The second and third options seem to be more robust for any future needs that anyone might have. Could it start with no numbering? For example

   Z:\playlist
   Z:\playlist\playlist.m3u8
   Z:\playlist\file1_in_playlist
   Z:\playlist\file2_in_playlist
   Z:\playlist1
   Z:\playlist1\playlist.m3u8
   Z:\playlist1\file1_in_playlist1
   Z:\playlist1\file2_in_playlist1

Also, since we place the files in different folders to we need renaming them into file_in_playlist(n) ?

For existing files I think the safest option should be to overwrite them, or even better have the option beforehand to overwrite them or add _(n) at the end of the file.

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 03, 2014, 12:19:34 am
The file names and playlist names, including the numbers, were just two example names I picked to help you see what was going on.   For example, "file2_in_playlist2" is really some file name like:

   09 Love Hammer.mp3

or if directories are to be used:

   Big Willie\His Big Monster\09 Love Hammer.mp3

The playlist names don't require any numbers; they will come from your own MC field, so however you want to name them is up to you.

I'm just tossing ideas out - you tell me what *you* need.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 03, 2014, 12:23:24 am
Here's the way to think about it.  You have some existing file paths, that look like:

   M:\A\B\C\D\E\foo.mp3

and you want to create a copy with a playlist to some other location X (this is the base path you give to the scriptlet).  What should the final path look like?  It will be something like:

   X\....

What should the .... look like?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 03, 2014, 12:33:51 am
I am sorry that it took me a while to completely understand what you were saying.

I think the third option would be the functional for me  :)

In this case since there might be some duplicate "Filename (name)"s in the same playlist and since the purpose of this kind of playlists is to take the songs with you, I guess the best option would be if the file comes from the same path it shouldn't be copied but if it comes from a different path the it should be copied like that  /file_(n)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 03, 2014, 12:55:13 am
Got it.

Your comments on dups in playlists.  This might be tricky.  Currently, once the file is copied, it exists as some named file.  Later, I have no idea from whence it came.  I can probably create a reverse relationship mapping the new file name back to the original path.

I think what I'm going to do is allow you to use some column in your view, which might be an expression column or field, which indicates the hierarchy to be used beneath X.  If the field is not there, or is empty, then there will be no subfolders hierarchy.  If you do have one, perhaps it is defined like:

   [Artist]\[Album]

then they will be used, creating:

   X\[Artist]\[Album]

Further, I could see allowing you to define the Filename part too and it could include automatically numbering the tracks using some special token like [seq]:

   X\[Artist]\[Album]\[seq] [Filename (name)]

This would allow file names like:

   01 Hello.mp3
   02 Goodbye.mp3
   03 For Now.mp3

or even the degenerate:

   01.mp3
   02.mp3
   03.mp3

This would give you complete control over the naming and location.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 03, 2014, 01:18:20 am
I like very much the option with the folder hierarchy.

The numbering in front of the file can be used maybe to protect the order of the songs in the playlists!  ;)

The script works on one file each time right? So, we can have the first file renamed to 01..., the second to 02... etc. In this way duplicates (only by "Filename (name)") won't trouble us.

The only problem could be the real duplicate entries in the playlist, but this isn't really a problem because the storage space is not really a problem nowadays, and we are not talking about the database where we don't want any duplicates but we are talking about a "playlist to go" where this is not a problem.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 03, 2014, 01:26:10 am
Yes, that's correct.  That's exactly why I suggested the [seq] number token, to allow you to number as you want.

The script works in three stages:

  1. pre-processing (which has access to everything but can't write back tags)
  2. per-file processing (which gets only a single files's data and can write back one or more values)
  3. post-processing (which only has access to its -a argument string, and can't write back tags)

The file numbering is trivial - all your files names and tags are held in an array, and the index is readily available.

I will track duplicate entries in the original playlist, and if there is no [seq] in use, then their new playlist entries will reference the single version of the copied file whatever its name may be.  I won't copy/store the same file twice in this case.  If you do use [seq] to sequence the files, then I suppose a copy will be created (I don't think I want to get into using symlinks or shortcuts because I don't know what the remote system will do with those).
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 03, 2014, 05:28:40 pm
If you have any beta version MrC I would be glad to test it :)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 03, 2014, 06:00:56 pm
I'm working on it now.  I'm just about to make the playlist entries relative instead of absolute (you want this option, right)?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 03, 2014, 06:13:26 pm
Yes, of course  :)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 03, 2014, 06:37:31 pm
Question.  Currently I'm allowing you to create multiple playlist groups:

   group1
       playlist.m3u8
       files
   group2
       playlist.m3u8
       files

I presume you want the sequence number restarted for each group, so files go from 1 to n inside each grouping.  Is this correct?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 04, 2014, 12:25:35 am
That's correct!

Do I have to process each group at once? That is, choose the playlist files and run the script once for each group?

Even if this is the case I won't have a problem cause each playlist has about 160 to 170 files in. But in such case shouldn't we consider the needs of others as well?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 04, 2014, 02:42:42 am
Sorry, I had some social engagements today.

You won't have to do one run / group.  All you need is some field that indicates the name you want to use for a playlist.  So if some group as a tag Playlist A and the others have Playlist B, then the script will split the files into two folders, each with their own playlist.m3u8 and their respective files in the order shown in the view.

I have everything done except dealing with overwriting files and avoiding duplicates.  Do you want to try out what I have?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 04, 2014, 02:48:31 am
Of course! Do you want to upload it here? I believe you also have my email, so however you prefer is fine :)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 04, 2014, 02:50:41 am
Please, also send me a sample command so that we avoid some mistakes there ;)

Should I add some duplicates in the playlist?

Do we need to test against other things as well, or just try it to some of my playlists and see how it goes?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 04, 2014, 03:27:58 am
Edit: The attached test version of pscriptor has been removed as this scriptlet is now included in the pscriptor release.  The scriptlet is now called CopyWithM3U8.

Here's a zip file that contains pscriptor.pl, the config file, and Scriptlets/Stiv32inator.pm.  Unzip and place them in the correct location.

You may need to add a new perl module.  In the command shell, use:

   ppm install Win32-Unicode

If you get other missing modules, do the same thing with the module name shown in the error message about missing modules.  Change the :: into a - character.

Here's a sample command line, and I'll explain the options, ignoring those you know about:

   perl pscriptor.pl -c pscriptor-config.txt -E Stiv32inator -f "Playlist" -a "base:M:\Copied Music  fname:<seq>-<fname>"

The -f option used with Stiv32inator indicates the playlist name.  The value in this field will be used to create the playlist groupings.  You can see in the screen shot my values Playlist A and Playlist B, and the folders created in the two sample output runs.  If the value in view for the -f field is empty, no playlist folder is created and files are placed in the base path.

The -a option supplies specific options to Stiv32inator.  There are currently four available options you can use to control how the files and folders are created.  The options take the form of opt:value, that is, the option name followed by a ':' character, followed by the value.  See below for more examples.  The three options are:

   - base  - defines the destination base path; everything gets placed either here or in subfolders.  This is required.

   - fname - defines how the file's name will be created.  It is optional and if omitted, the source file's name will be used.  If you use the fname option, there are some "tokens" that can be used to define how to create the fname.  Two tokens are pre-defined: <seq> and <fname>, but your track columns can be used too.  The token <seq> is the per/playlist sequence number and is optional.  It also accepts a digit-width specifier to indicate how many digits you want (for padding).  For example, use <seq,3> for 3 digits.  The simple value <seq> would output a 1 digit sequence.  The <fname> token is the file's name.  It is optional also.   You can add extra characters between tokens and they will be output as part of the filename.  To use values from your file list columns, use the token <[column]> where column is the name of your column.

   - folderfield - this is the name of an expression column in the view. The value in the view should be an expression that creates a valid path fragment, defining where files will go.  For example, if you want your playlist files to go into an artist\album hierarchy, use the expression: [Artist]\[Album].  Then, files will go into: base\folderfield\name.  Certain illegal file system characters are transformed into underbar.

   - delete - this option when set to 'yes' will delete pre-existing destination files.  Otherwise, a new file with the same name as an existing file will have its named appended with "(n)", where n is the next available unused index in the directory.

Here are a few examples from, from the -f option onwards:

    -f "Playlists" -a "base:M:\Music\Copied"
    -f "Playlists" -a "base:M:\Music\Copied  fname:<seq> delete:yes"
    -f "Playlists" -a "base:M:\Music\Copied  fname:<seq>"
    -f "Playlists" -a "base:M:\Music\Copied  fname:<seq,5>"
    -f "Playlists" -a "base:M:\Music\Copied  fname:<seq> <fname>"
    -f "Playlists" -a "base:M:\Music\Copied  fname:<seq,2>--<fname>"
    -f "Playlists" -a "base:M:\Music\Copied  fname:<seq,4> <[name]>-<[bitrate]>"
    -f "Playlists" -a "base:M:\Music\Copied  folderfield:MyFolderExpr  fname:<seq,2>--<fname>"

As usual, add the -v option on the command line if you want to see verbose output about file and folder creation, file copies, etc.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 04, 2014, 04:06:20 am
When do we use Clean() ?

I get this


perl pscriptor.pl -v -c pscriptor-config.txt -E Stiv32inator -f "
M3U8_Playlists" -a "base:C:\1  forlerfield:music name:<seq,3>-<name>"
Uncaught exception from user code:
        Stiv32inator: Destination base path is not a clean base path - it contai
ns filesystem illegal characters.
        Stopped at Scriptlets/Stiv32inator.pm line 61.
        Stiv32inator::do_preprocessing("base:C:\\1  forlerfield:music name:<seq,
3>-<name>", ARRAY(0x2c4a710), ARRAY(0x2ffd778)) called at pscriptor.pl line 148

I just copy pasted the Sitv32inator script. Should I get also pscriptor.pl and config file?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 04, 2014, 04:08:56 am
.... M3U8_Playlists" -a "base:C:\1  forlerfield:music name:<seq,3>-<name>"

The problem is that you've misspelled folderfield, so that option isn't recognized, therefore it looks like your base path is:

   C:\1  forlerfield:music

and : is illegal.  You don't need Clean() - I do that for you.

Update all three files - that's why I included them.  You can ignore the config file for now.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 04, 2014, 04:48:03 am
At the first playlist I checked everything went fine. All 168 files were copied and the order of the songs in playlist was kept fine since I could order the tracks by Filename.

Instead of

name:<seq>-<name>

can I change it to something like

name:<seq>-<Filename (name)> ?
[/s]

What I wanted to say is

In addition to adding the Seq to "Filename (name)" can we add it also to "Name" of the track?

I ask this because when we load the playlist at some players we can see just the Name of the track and not the Filename, so we can't order by Filename.
Thank you very much MrC

ps. I will do some more testing and write here if I have any problems

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 04, 2014, 04:51:14 am
Great.

The <name> token is Filename (name).
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 04, 2014, 04:56:30 am
Sorry I corrected my question  :-[



Instead of

name:<seq>-<name>

can I change it to something like

name:<seq>-<Filename (name)> ?
[/s]

What I wanted to say is

In addition to adding the Seq to "Filename (name)" can we add it also to "Name" of the track?

I ask this because when we load the playlist at some players we can see just the Name of the track and not the Filename, so we can't sort by Filename.
Thank you very much MrC


Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 04, 2014, 05:02:21 am
I'll take care of this tomorrow.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 04, 2014, 05:06:23 am
Thanks  :D
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 04, 2014, 12:17:07 pm
I've updated the post above with a new zip file containing the updated scriptlet.  It includes the requested change to include your column data in your file's name.  This is done via the syntax:

   <[column]>

where column is the name if your file list column.

In addition, I've changed the name of the -a option which was named "name" to "fname" and also its token "<name>" is now "<fname>".  It is easier to reference this way, and won't collide with the "name" column in your data.  See the updated examples and description.

To include the your column values in a track name:

  a "base:M:\Music\Copied fname:<[artist]>-<[bitrate]>bps"



   
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 04, 2014, 05:30:04 pm
I've updated the test code zip archive again.  This now includes the ability to delete existing files, duplicate detection, and name conflict avoidance.

Delete Existing Files:
There is a new -a option:

    delete:yes

which when used will cause deletion of pre-existing files.

Duplicate Detection
A source file listed multiple times in a playlist will be copied only once so long as the destination name does not change.  It would not change, for example, if the destination file name is some static value, like the source file's file name, but it would change if the destination file name was to be a sequence number.  The code does not examine file content.

Name Conflict Avoidance
If the destination file already exists, a (n) will be appended to the destination file name.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 04, 2014, 06:33:32 pm

Can I use it like this?

perl pscriptor.pl -v -c pscriptor-config.txt -E Stiv32inator -f "
M3U8_Playlists" -a "base:C:\1  delete:yes forlderfield:[artist] fname:<[artist]>-<fname>-<seq,3>"

I will run some tests and I will write you here how it goes?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 04, 2014, 08:50:44 pm
Not quite - you have:

   perl pscriptor.pl -v -c pscriptor-config.txt -E Stiv32inator -f "M3U8_Playlists" -a "base:C:\1  delete:yes forlderfield:[artist] fname:<[artist]>-<fname>-<seq,3>"

Note the typo of forlderfield and the value here [artist] is not an MC field, but the name of one of your columns. so you probably meant:

   perl pscriptor.pl -v -c pscriptor-config.txt -E Stiv32inator -f "M3U8_Playlists" -a "base:C:\1  delete:yes folderfield:artist fname:<[artist]>-<fname>-<seq,3>"

p.s.  I think I'm going to change the way -a args are processed.   I think something like this would be better:

   perl pscriptor.pl -v -c pscriptor-config.txt -E Stiv32inator -f "M3U8_Playlists" -- --base C:\1  --delete:yes --folderfield artist --fname "<[artist]>-<fname>-<seq,3>"

That is, everything after a lone -- will go to the scriptlets, so you can use options similar to how they are used by pscriptor itself (and -a could be used for simple scriptlet options).

Also, by the way, the later you place the -v (or -d), the less verbose (or debug) output you'll get.  This is especially useful after the -c option, so you get less verbose output regarding processing the config file, etc.  It is also easier to remove when you recall/edit your previous command.  Example:

   perl pscriptor.pl -c pscriptor-config.txt -E Stiv32inator -f "M3U8_Playlists" -a "base:C:\1  delete:yes folderfield:artist fname:<[artist]>-<fname>-<seq,3>" -v
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 05, 2014, 05:51:10 am
So, I tried adding the playlist to different programs and everything worked as we expected.

I also copied the folder with the playlist to my android phone, but no application would load the .m3u8 playlist.

Not all the applications showed the [Filename (name)] at their playlist windows (most of them show [Name] only) but that didn't affect the order of the tracks... at least at the programs I tested it.
I renamed the playlist.m3u8 to playlist.m3u. This worked.

Accidentally I found a limitation of most android music application. They could read only 99 files from a playlist. Out of 10 applications only two could read the whole 168 files of the playlist. (I know it is out of the topic, but I found it a bit strange and also want to point out that it is not a limitation of the script).

So we have a script that can extract to .m3u8 playlist (and .m3u in UTF-8 (right?) if we just rename the playlist file) all the selected files in MC.

And this can be used to take the files with us in a stick, external disk, mobile phone or mp3 player even if the files (songs, videos, photos) have names with characters like ñ, ó, é, έ, η etc.

Thank you very much MrC !
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 05, 2014, 11:26:07 am
You're welcome, and thanks for testing it out.  I'll wait a short while before pushing out a full release, in case you find any issues.

I'm still considering changing/amending the scriptlet argument processing.

M3U8 files are UTF-8 Unicode.  M3U files are Windows 1252 (http://en.wikipedia.org/wiki/Windows-1252) (the Latin-1 character set).  So technically renaming the M3U8 to M3U is not quite correct.  If it works for your application, great.  I suppose the reason MC doesn't include M3U8 capabilities for HH or conversion is due to what you discovered - not all devices can handle the format, and not all file systems are UTF-8.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: arin on May 06, 2014, 05:23:14 am
The @INC path in the error message from perl shows that the OS X version of perl is being used, not the new /opt/local/bin version you installed via Mac Ports.

Try looking at the PATH environment variable:

   echo $PATH

Code: [Select]
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/Users/MrC/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

and if /opt/local/bin is not at the front of the PATH, that's the cause.  Did you start up and use a new Terminal window (new shell) after installing the MacPorts package?  (see my above message about this).  MacPorts will add this entry:

Code: [Select]
# MacPorts Installer addition on 2013-04-06_at_09:45:09: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

to your .bash_profile.  Having the PATH set properly means you don't have to type full path names to the executables in /opt/local/bin:

   /opt/local/bin/perl pscriptor.pl ....

and instead can use:

   perl pscriptor.pl ....



Hi MrC!
I'm really puzzled…
And I was trying to understand by myself why the Mac Ports installer doesn't put perl where it should, according to what you told me.
The only perl I can see in /opt/local/bin is perl5.16 and being dumb I even tried to run pscriptor using that one but failed, of course…

When I type $ which perl
the only response I get is:
/usr/bin/perl

When I type $ echo $PATH
I get this:
/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin


I tried to re-uninstall ActivePerl for mac and of course it says it doesn't find anything to uninstall.

I also tried to install Mac Ports many times, being a little frustrated, and I always got the message that everything went ok.
But perl is not where it should be anyway...

And now I really need your help! ?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 06, 2014, 11:27:04 am
There may be several perl versions installed:

$ ls -l /opt/local/bin/perl*
lrwxr-xr-x  1 root  admin      8 Oct 26  2013 /opt/local/bin/perl@ -> perl5.12
lrwxr-xr-x  1 root  admin      8 Oct 26  2013 /opt/local/bin/perl5@ -> perl5.12
-rwxr-xr-x  1 root  admin  14008 Dec  1 21:04 /opt/local/bin/perl5.12*
lrwxr-xr-x  1 root  admin      8 Dec  1 21:04 /opt/local/bin/perl5.12.4@ -> perl5.12
-rwxr-xr-x  1 root  admin  13956 Apr  3 16:18 /opt/local/bin/perl5.16*
lrwxr-xr-x  1 root  admin      8 Apr  3 16:18 /opt/local/bin/perl5.16.3@ -> perl5.16
lrwxr-xr-x  1 root  admin     12 Oct 26  2013 /opt/local/bin/perlbug@ -> perlbug-5.12
-rwxr-xr-x  2 root  admin  45815 Dec  1 21:04 /opt/local/bin/perlbug-5.12*
-rwxr-xr-x  2 root  admin  41712 Apr  3 16:18 /opt/local/bin/perlbug-5.16*
lrwxr-xr-x  1 root  admin     12 Oct 26  2013 /opt/local/bin/perldoc@ -> perldoc-5.12
-rwxr-xr-x  1 root  admin    244 Dec  1 21:04 /opt/local/bin/perldoc-5.12*
-rwxr-xr-x  1 root  admin    244 Apr  3 16:18 /opt/local/bin/perldoc-5.16*
lrwxr-xr-x  1 root  admin     12 Oct 26  2013 /opt/local/bin/perlivp@ -> perlivp-5.12
-rwxr-xr-x  1 root  admin  12484 Dec  1 21:04 /opt/local/bin/perlivp-5.12*
-rwxr-xr-x  1 root  admin  10802 Apr  3 16:18 /opt/local/bin/perlivp-5.16*
lrwxr-xr-x  1 root  admin     15 Oct 26  2013 /opt/local/bin/perlthanks@ -> perlthanks-5.12
-rwxr-xr-x  2 root  admin  45815 Dec  1 21:04 /opt/local/bin/perlthanks-5.12*
-rwxr-xr-x  2 root  admin  41712 Apr  3 16:18 /opt/local/bin/perlthanks-5.16*

Since its best to use version 5.16, I created an alias in my .bash_profile:

$ grep perl .bash_profile
alias perl='perl5.16'

Once you do that, it will be available for each new shell you start, and to force the reading of that file by your current shell, you can "source" the file:

$ source .bash_profile

You can see which perl5.16 is found:

$ which perl5.16
/opt/local/bin/perl5.16

and you can see the version:

$ perl --version

This is perl 5, version 16, subversion 3 (v5.16.3) built for darwin-thread-multi-2level
...

If you have not installed 5.16, you can install it with:

$ sudo port install perl5.16
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: arin on May 08, 2014, 04:46:59 am
Sorry to bother you but…I told you I was dumb… ;D


When I go:

$ grep perl .bash_profile
alias perl='perl5.16'

I get:

grep: .bash_profile: No such file or directory



When I go:

$ source .bash_profile

I get:

-bash: alias: .bash_profile: not found



When I go:

$ which perl5.16

I get:
/opt/local/bin/perl5.16


How can I create a .bash_profile?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 08, 2014, 12:24:12 pm
The easiest way in the command shell.  Copy and paste the command:

   echo "alias perl='perl5.16'" > ~/.bash_profile
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 10, 2014, 07:46:48 am
Hello MrC,

I am trying to use the Stiv32inator script with this command

perl pscriptor.pl -c pscriptor-config.txt -E Stiv32inator -f "M3U8_Playlists" -a "base:C:\SDCARD folderfield:folderfield fname: <seq,3>-<fname>"

unfortunately processes the command when I have chosen from 1 to 20 files.

The previous time I used it, it could processed 160 files without any problem. I have checked my ram and I am using less than 2gb out of 6gb. Is there something I can do to force it copy the files into clipboard so that they can be processed from the script?

Thank you
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 10, 2014, 10:43:59 am
Hi Stiv32 - I'm not sure I understand what the error or problem is.  What is happening?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 10, 2014, 02:18:56 pm
It isn't really a script error. I choose all the files in the playlist but they aren't copied to clipboard. So, they can't be processed through the script.

What is strange is that last week I had chosen 160 files in a playlist and everything went fine. This time the files are only 120 and they can't be copied to clipboard. I can process only 20 files per time.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 10, 2014, 02:20:33 pm
Are you able to select the files in MC, and Edit > Copy, and then paste the results into a spreadsheet or Notepad?  Do all the files appear?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 10, 2014, 02:48:19 pm
Alright, I found what was the problem. I just had to remove the "Playlist Paths" column from "view", because it carries too much information. Now, everything works great!

I noticed this when I tried to copy some of the files with edit > copy as you pointed out :)

Thank you very much!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 10, 2014, 02:53:22 pm
I've seen on a couple of occasions that MC has trouble CSV-ifying the clipboard data when certain columns are present.  But I haven't followed up on it.  When you copied the files and pasted into Notepad, did MC not carry all the rows of data?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 10, 2014, 11:32:20 pm
When I pasted into the Notepad, I noticed that it hadn't copied any data. When I choose only one file and copied - pasted, the information pasted was half a page. It was because of the Playlists Paths column.

About the WhichPlaylists script. Last week I noticed that it returned not only the Playlists paths that I had created, but also the paths of the playlists that MC auto-creates. That is, "Recently imported", "Recently Played". The information kept at those auto created Playlists is too much because one song can be present at many playlists and those playlists have names that are really long.

What I need to do, is empty the "Playlist Paths" column, delete the "Imported Playlists" and "Recently Imported" groups of playlists and rerun the WhichPlaylists script. In that way my "Playlist Paths" column will be clean.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 10, 2014, 11:48:54 pm
Interesting.

Would it be helpful to be able to configure certain playlist paths that should be ignored?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 10, 2014, 11:52:21 pm
Yes, it would. In that way every time I run WhichPlaylists I won't have to delete those playlist groups.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 10, 2014, 11:58:34 pm

p.s.  I think I'm going to change the way -a args are processed.   I think something like this would be better:

   perl pscriptor.pl -v -c pscriptor-config.txt -E Stiv32inator -f "M3U8_Playlists" -- --base C:\1  --delete:yes --folderfield artist --fname "<[artist]>-<fname>-<seq,3>"

That is, everything after a lone -- will go to the scriptlets, so you can use options similar to how they are used by pscriptor itself (and -a could be used for simple scriptlet options).


I already have understood how  -a args work, and I will adapt easily to the new way. if you believe that it will be easier for new users to understand how this works then by all means change it. :)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 11, 2014, 12:29:24 am
Edit: The attached whichplaylists zip has been removed as the change has been incorporated into the pscriptor release.

Yes, it would. In that way every time I run WhichPlaylists I won't have to delete those playlist groups.

Ok, here you go.  The attached zip file contains the WhichPlaylists scriptlet and a new config file.  For this update, you only need the last two lines of the config file - copy those into your own if that will save you some time.  These look like:


Code: [Select]
  # WhichPlaylists
   WhichPlaylists::Var: ignored_playlists_re       = ^Recent Playing Now's\\.*     # regular expression defining playlists to be ignored

The variable ignored_playlists_re defines a regular expression to be used to match against the full playlist path.  The default one ignores Recent Playing Now's\... paths.  If you want to add more, you'll need to understand REs.  You might want something like:

Code: [Select]
  WhichPlaylists::Var: ignored_playlists_re       = ^(Recent Playing Now's\\.*|Recently Imported)$
Use the -v verbose option to see what is being skipped:

Code: [Select]
Playlists found: 2013237201 = Testing 2: B\Testing 2
Playlists found: 536715510 = Testing 2: A\AA\Testing 2
Playlists found: 1067419728 = Test 2: Test 2
Playlists found: 2138030397 = 05/10/14 09:57:50 pm: Recent Playing Now's\05/10/14 09:57:50 pm
Skipping ignored playlist: Recent Playing Now's\05/10/14 09:57:50 pm
Playlists found: 1005581327 = Testing 3: A\AA\AAA\Testing 3
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 11, 2014, 12:35:21 am
I already have understood how  -a args work, and I will adapt easily to the new way. if you believe that it will be easier for new users to understand how this works then by all means change it. :)

Thanks for the feedback.

Really its a matter of how well I can produce error messages for incorrect arguments.  The way I'm doing it now allows you to place -a <args> anywhere.  And I may still keep that method for some scriptlets.  But quoting long strings with arbitrary characters is hard for users, so I'm using some trickery to work out what are arguments and values.  And the new Stiv32inator script has difficult -a options (that's why you got tripped with with the fieldname typo a few posts back - I had no way to warn you since it looked like part of the previous argument).   So I think for some scriptlets, like Stiv32inator, it make sense to use -- and pass everything as real option/value arguments.  Then, I can detect, warn and croak on incorrect options.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: stiv32 on May 11, 2014, 12:56:57 am
I downloaded the new WhichPlaylists so I am going to post back if I have any problems  :)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 12, 2014, 08:31:23 pm
Version 1.13 is now posted.

Changes in Version 1.13:
    - Fix: --help option was not working.
    - Fix: minor typos in scriptlet Numberize.
    - Fix: undefined perfile callback function was not being properly detected.
    - Fix: suppress some extraneous verbose output when there is no per-file scriptlet function.
    - New: DateParse scriptlet's year, month, day separator can now be specified as an RE pattern.
      The default pattern includes - (dash) and . (dot).  See the date_separator variable in the
      config file.  The same separator will be used throughout the date (first one found is used
      on as the next separator).
    - New: RandomPlaybackRange scriptlet now clears the Bookmark field when setting the Playback
      Range field.  Also, the script supports a new option to clear Playback Range and Bookmark.
      Use the "clear" argument with -a (e.g. -a clear).
    - New: WhichPlaylists scriptlet can now ignore playlists matched by a regular expression.
      See the variable ignore_playlists_re in the config file under the WhichPlaylists section.
    - New: scriptlet CopyWithM3U8 copies files and creates M3U8 playlists for those files.  The
      folder and filename rules are customizable, allowing you to rename copied files, including
      using sequence numbers.  See the instructions inside the scriptlet file.

Note: the CopyWithM3U8 (formerly called Stiv32inator during testing) has changed the way it processes arguments.  The scriptlet no longer uses the -a option and its complex double-quoted argument string.  Instead, the scriptlet uses everything on the command line after a double-dash.    Example:

    perl pscriptor.pl -c pscriptor-config.txt -E CopyWithM3U8 -f 'MyGroupField' -- --base "M:\My Copied Music" --folder Playlists --file "<seq> <fname>"

All the stuff in blue (that is, everything after the lone --) is processed by the scriptlet, and the form of the scriptlet options now follows the same style as pscriptor's main options.  Use --help as a scriptlet option to see the scriptlet's options:

Code: [Select]
perl pscriptor.pl -c pscriptor-config.txt -E CopyWithM3U8 -f "My Group Field" -- --help

CopyWithM3U8 options:
    --basepath    | -b <base path> # base path of the destination folder
    --delete      | -d # delete existing files first?
    --help  | -h # output scriptlet help and usage text
    --filename    | -f <filename spec> # the specification that defines how filenames should be constructed
    --folderfield | -F <column name> # the name of a column that defines the sub-folder component

Stopped

You may have noticed that in the first example above, the scriptlet option --filename has been abbreviated as --file.  In fact, any option may be abbreviated to an unambiguous form, so --fo would be acceptable as --foldername and --fi would be acceptable as --filename.  Of course, the single letter options are still valid, with -F for --foldername and -f for --filename.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 14, 2014, 08:44:55 pm
I've posted version 1.14.  The big change is that the default config file is now automatically included, and it will include a custom config file you create, so this will greatly reduce the difficulty in migrating your settings as you update.

Changes in Version 1.14
    - Change: Split the README.txt file into three files: README.first.txt, README.install.txt,
      and README.usage.txt.  Added more instructions for intstallation on OS X.
    - Change: the default config file (pscript-config.txt) is read automataically, so you no
      longer have to specify the -c option (unless you want a config file other than the
      default).  Also, see next note.
    - New: a config file can use a new inclusion rule to include another config file.  This
      allows you to configure your own custom config file with only the differences from the
      default config file.  You can see the include rule at the bottom of the default config
      file.  It includes the file named pscriptor-config-custom.txt.  This file is one you
      can create, and it will not be overwritten on updates (unlike the default config file).
      A good usage of the custom config file would be to store your MCWS_* settings.
    - Fix: DateParse scriptlet failed to detect dates of the format D-MM-YYYY.

Using the example run from the post above, the new command line would look like:

    perl pscriptor.pl -E CopyWithM3U8 -f 'MyGroupField' -- --base "M:\My Copied Music" --folder Playlists --file "<seq> <fname>"
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 15, 2014, 11:22:57 am
I've re-uploaded version 1.14 - the zip file did not include the new README files.  You should re-download the zip file if you did so before this posting.

Sorry about that.
Title: Obtaining playback ranges for particles
Post by: jmone on May 22, 2014, 01:17:52 am
Unfortunately in my testing I've found they either don't exist for most, or when they do they splitting based on the track length + trackgap does not hit the right mark on all tracks.

By the way, if MediaInfo can read the chapter start/stop values, I already have a pscriptor scriptlet that uses it, and another one that sets playback range.  It would be easy enough to modify it to instead pull these values.

:) So, I've been checking out what accurate Chapter Info can be pulled by various progs.... and Media Info can do it if it is fed the right MPLS (see pic).  Other progs like madshi's eac3to can also export out chapter times to a txt file.

Thanks
Nathan

Title: Obtaining playback ranges for particles
Post by: MrC on May 22, 2014, 01:30:15 am
Since MediaInfo is command line driven, it is something I can use.   I could also call eac3to and parse the txt file.
Title: Obtaining playback ranges for particles
Post by: jmone on May 22, 2014, 02:36:59 am
Does this help?  I tried adding "--Inform=Menu" and "--Inform=Chapter" to cut it down but.... the output was the same.

The downside is you have to guess the correct playlist (and there could be more than one), eg in MC the file is shown as:
".....\The Rolling Stones Eoms\BDMV\index.bluray;1" and to get it to work in mediainfo the correct playlist is
".....\the rolling stones eoms\bdmv\playlist\00000.mpls"
see below

Code: [Select]
C:\Users\Nathan\Downloads\MediaInfo_CLI>mediainfo "m:\media\discs\the rolling st
ones eoms\bdmv\playlist\00000.mpls"
General
Complete name                            : m:\media\discs\the rolling stones eom
s\bdmv\playlist\00000.mpls
Format                                   : Blu-ray Playlist
File size                                : 496 Bytes
Duration                                 : 1h 7mn
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 bps

Video
ID                                       : 4113 (0x1011)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Format settings, GOP                     : M=3, N=18
Codec ID                                 : 27
Duration                                 : 1h 7mn
Bit rate mode                            : Variable
Bit rate                                 : 11.4 Mbps
Maximum bit rate                         : 40.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 24.000 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.230
Stream size                              : 5.40 GiB (60%)
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
format_identifier                        : HDMV
Source                                   : 00000.m2ts

Audio #1
ID                                       : 4352 (0x1100)
Menu ID                                  : 1 (0x1)
Format                                   : PCM
Format settings, Endianness              : Big
Format settings, Sign                    : Signed
Muxing mode                              : Blu-ray
Codec ID                                 : 128
Duration                                 : 1h 7mn
Bit rate mode                            : Constant
Bit rate                                 : 4 608 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 96.0 KHz
Bit depth                                : 24 bits
Stream size                              : 2.18 GiB (24%)
Language                                 : English
format_identifier                        : HDMV
Source                                   : 00000.m2ts

Audio #2
ID                                       : 4353 (0x1101)
Menu ID                                  : 1 (0x1)
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Format profile                           : 96/24 / Core
Mode                                     : 16
Format settings, Endianness              : Big
Muxing mode                              : Stream extension
Codec ID                                 : 134
Duration                                 : 1h 7mn
Bit rate mode                            : Constant
Bit rate                                 : 1 509 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 96.0 KHz / 48.0 KHz
Bit depth                                : 24 bits
Compression mode                         : Lossy
Stream size                              : 731 MiB (8%)
Language                                 : English
Source                                   : 00000.m2ts

Audio #3
ID                                       : 4354 (0x1102)
Menu ID                                  : 1 (0x1)
Format                                   : TrueHD / AC-3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Muxing mode                              : Stream extension
Codec ID                                 : 131
Duration                                 : 1h 7mn
Bit rate mode                            : Variable / Constant
Bit rate                                 : 640 Kbps
Maximum bit rate                         : 3 036 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: C / Front: L R
Sampling rate                            : 96.0 KHz / 48.0 KHz
Bit depth                                : 16 bits
Compression mode                         : Lossless
Stream size                              : 310 MiB (3%)
Language                                 : English
bsid                                     : 6
dialnorm                                 : -31
dialnorm/String                          : -31 dB
compr                                    : -0.28
compr/String                             : -0.28 dB
dsurmod                                  : 1
dsurmod/String                           : Not Dolby Surround encoded
acmod                                    : 2
lfeon                                    : 0
dialnorm_Average                         : -31
dialnorm_Average/String                  : -31 dB
dialnorm_Minimum                         : -31
dialnorm_Minimum/String                  : -31 dB
dialnorm_Maximum                         : -31
dialnorm_Maximum/String                  : -31 dB
dialnorm_Count                           : 1157
compr_Average                            : -2.72
compr_Average/String                     : -2.72 dB
compr_Minimum                            : -7.82
compr_Minimum/String                     : -7.82 dB
compr_Maximum                            : -0.28
compr_Maximum/String                     : -0.28 dB
compr_Count                              : 1157
format_identifier                        : AC-3
Source                                   : 00000.m2ts

Menu
00:00:00.000                             : Chapter 1
00:04:33.583                             : Chapter 2
00:06:59.666                             : Chapter 3
00:09:57.500                             : Chapter 4
00:13:33.375                             : Chapter 5
00:17:21.958                             : Chapter 6
00:21:49.125                             : Chapter 7
00:26:08.333                             : Chapter 8
00:29:07.916                             : Chapter 9
00:33:36.000                             : Chapter 10
00:36:43.000                             : Chapter 11
00:39:20.500                             : Chapter 12
00:42:45.166                             : Chapter 13
00:45:40.083                             : Chapter 14
00:51:01.458                             : Chapter 15
00:54:52.375                             : Chapter 16
00:59:29.833                             : Chapter 17
01:03:47.125                             : Chapter 18



C:\Users\Nathan\Downloads\MediaInfo_CLI>
Title: Obtaining playback ranges for particles
Post by: jmone on May 22, 2014, 02:42:47 am
Did some more testing in MC and I can create particles with a filename that references the correct playlist in the format of
".....\The Rolling Stones Eoms\BDMV\PLAYLIST\00000.mpls"

If you just use the "File Name" contained in MC then I can change how these entries are created (and update the wiki).  This way there is no guessing as the user would create the particles from the desired playlist (it's an extra step for the user but it gets the all the tracks from a BD even if it is in mulitple playlists)  ;D
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 22, 2014, 11:34:31 am
Great, thanks.  I think instead of using the filename, I might suggest that a user-field or expression column be used to indicate the MPLS value.  This could be derived them from any method you or other choose.

That chapter info will be easy enough to parse and populate.  I'll get on it.  In the mean time, your job is to become familiar with  pscriptor.  Start ReadMe'ing...
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 22, 2014, 02:50:34 pm
I've been a bad boy.

I've successfully created particles programmatically.

I used discogs.pl's ability to create all the necessary dummy files from a release entry, imported them into MC, and turned all but the first entry into particles with pscriptor, with the top entry being the top of stack member.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 22, 2014, 03:39:16 pm
 ;D You are a Good Good Boy
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 22, 2014, 11:50:18 pm
Like I said, a very naughty boy:

   https://dl.dropboxusercontent.com/u/87189402/Auto-Particles.mp4 (https://dl.dropboxusercontent.com/u/87189402/Auto-Particles.mp4)

Download and play the movie.   Here's what's happening:

1. Discogs.pl creates dummy files from the given Discogs ID, and it creates an import.mpl file.
2. In MC, File > Import Playlist that import.mpl and MC populates entries for the files.
3. Pscriptor.pl is called with a new scriptlet Particlize which does some magic to make all the dummy files particles, deletes the dummy files, and sets the top file to be the top of stack, referring to all the members.  Ignore the 5 second pause; that was for debugging - it is gone now.

Magic.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 12:16:23 am
 ;D ;D ;D I've done my reading, and ready to test!

F5 F5 F5 F5
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 23, 2014, 12:53:00 am
Ok, here are two pre-releases of both discogs and pscriptor.  Please read the Changes logs, as there have been some changes particularly with the config files being automatically read (no more -c config-file required).

You'll do best by opening up two command windows, using one for discogs and the other for pscriptor.

Here's the way you should work.  Create a new view.  Include in that view:

   - the Filename column
   - an expression column named FileKey with the expression: FileKey()
   - an expression column named Stack Top with the expression: [Stack Top]
   - an expression column named Stack Files with the expression: [Stack Files]
   - setup the view to include the ParticleTest dummy file directory below (or whatever you call it) and to include your media files you want particlized.  Then use Search to select a single title (I had "exile" in my Search box in the window, since it was the common word in the files to be imported and that I wanted to work with).
   - The main file you want to work on MUST end up sorted at the top of the list after you import below.  Its values are used as the basis for particlizing the dummy entries and setting up the connections in the main file.  No longer required.

1. Run the discogs command to create the dummy files from an Discogs entry.  Example:

   perl discogs.pl --rid 5397834 --create --basedir C:\Users\MrC\Desktop\ParticleTest

2. Import the import.mpl playlist using File > Import Playlist in MC.

3. Select the main file and the dummy files, and run pscriptor selecting the Particlize script, supplying a dummy field with -f (it isn't used) and you must use --filekey.  Remember, the main file must be sorted to the top.  Example:

   perl pscriptor.pl -E Particlize -v -f dummyfield --filekey

Once it runs, you should now have stacked particles with the original file being the top of stack.

Particlize deletes the dummy files for you.  It also tells MC to temporarily rename your main file (it changes the Filename field and then at the end changes it back).  This is required to keep MC from auto-suffixing existing files with (1), thus breaking the linkage, when the Filename field for all the dummy file entries are set to match the main file.

Since this is all new, and I haven't spent much time testing out all the angles, maybe work on some test files for a while until we work out the kinks.

I haven't added the playback range stuff in yet.  That comes next.

Edit: archive files removed.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 02:35:43 am
Ok - I've been stepping though this carefully

Part 1 - Creating Dummy Files is fine
Part 2 - Failing with Field not available in the view.....

I'm sure I've stuffed something up....

edit - bad screen shot I did have all lines selected
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 23, 2014, 02:43:58 am
Two things.

Create the custom config file to quiet the warning.

Add a field to the view that you don't care about.  That will be your dummy field.  Use it's name.  I have a _test field I use for scratch purposes.  So I use -f _test as the option.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 02:57:20 am
Getting closer!

It works and creates the particles (p2.png), but when I change the Media Type (manually) to Video (p3.png), the filename then changes (very odd).  See the two pics.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 03:03:03 am
Mmmm I created the dummy files using --media type Video and they were created with the Video File type.  Did the second pscriptor to make them particles, also fine.  Then tried to play one and all of a sudden all the filenames where changed to as you see in P3.PNG above and of course they don't play.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 23, 2014, 03:04:25 am
That's weird.  Try setting the media type first, before calling pscriptor.

Also, be sure your dummy files are not in an auto import folder.  I think I recall you don't use
A.I.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 23, 2014, 03:10:00 am
I'll have to test out BD tomorrow.  I'm baffled as to how MC changed the names like that.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 03:12:17 am
Yup don't use AutoImport.  Tested further.
- Created the Dummy files using --media type Video and imported them --> OK with Media Type = Video
- ran pscriptor and it looked fine with the correct Filename and the Stack Files / Stack Top entry cross populated
- did nothing then after about 5 sec, MC just changed the Filenames again replacing the "Name" portion of the filename with at from the "Name" field".  

Very Very Odd but it could be how particles work.  Unless you have another suggestion, how about this for a workflow (follows more how MC does it).
- Use Media Info to create the correct number of Particles based on the Chapters from the Base file populating just Track #, Playback Range but keep "Name" the same as the base files, then
- Use Discogs or AGM script to populate the metadata?

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 03:24:42 am
OK - I can confirm if I change the Name of each of the dummy tracks to "The Rolling Stones Eoms" prior to running pscriptor it is fine (also needed to change the File Type from MP3 to bdmv).  Also the Meta Data of the original does not match that of the particles from which has been populated from online (eg I'd suggest that the original should also be updated to have the same Meta Data)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 03:47:32 am
Thinking some more about the workflow and the testing I've done on other BD, we can not rely of Discogs or AMG to always have the correct info for even the number of names of the tracks, while Media Info will be able to always list the correct #of tracks to create (and their associated playback times).  So if the particles could be created from Media Info Chatper Info first (but with the same meta data from the original (from it's sidecar file maybe?)) then we can run the existing Discogs or AMG scripts as needed to update the meta data over all of them.

...if this makes sense of course!

Thanks for looking at this.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 03:54:36 am
Quote
This is required to keep MC from auto-suffixing existing files with (1), thus breaking the linkage, when the Filename field for all the dummy file entries are set to match the main file.

This is a key find! as I'd tried the MPL approach before and always have this problem and trying to then change it in MC GUI then caused all sorts of issues!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 23, 2014, 12:11:14 pm
As I was falling asleep last night, I realized that MC probably is treating the conglomerate files differently than the simple single file case that I was testing.  Since I'm developing on a Mac, I don't have MC access to BD or DVD here, so just used mp3.  So at least we have a workable method for non-conglomerate files, and this might be useful as is.

I'll work out the issues with conglomerates on the PC side, if possible.

I currently don't have a pscriptor scriptlet to create the dummy files (that capability is in amg.pl and discogs.pl, but the code is in a module shared by all the programs, so it will be easy to implement a scriptlet to do this).

I'll work with DVDs rips first, call MediaInfo to get the chapter data, and then have the new scriptlet create particles, of course also setting the playback range values for each.  Then I'll see if I can rip a BD and test that out.

You can use the MC UI to rename the particles, but you have to first rename the main file so that MC will allow renaming of the particles to match the original main file name.  Then the main file can be renamed in MC (You can edit the Filename field to do this).

The changing of Name prior to running pscriptor is an interesting find.  I'm pondering why this should matter to MC and what it is doing with those conglomerates.

Edit: I see the change of name on the PC side even with the simple file.  It doesn't happen on the Mac.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 23, 2014, 03:30:42 pm
OK, I have it working fine for your DVDs.  You had the answer - Album had to be set for the top file.   So now I'm pushing down File Type, Media Type, Media Sub Type, and pushing up Album.  I've attached an updated Particlizer - unzip and place it in Scriptlets.  It also now warns of missing fields in the file list.

Does Playback Range not work on ripped DVDs?  Seems it always goes through the intro junk on the DVD.

Off and ripping a BD now (Memento SE)...

Edit: archive file removed.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 03:59:47 pm
Thanks - I'll test the new script in a bit (got to get a coffee into me first).... but from what I remember on the discussion with Matt re DVD "Time Based Particles" & Playback Range is that they we a strange beast (in that it does not seem to work). 
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 04:14:59 pm
Looks like one to add to my list of Particle improvements:
- DVD Title Particles are fine (I have plenty of these for TV Shows) & and uses the "JRiver DVD Reader" filter
- DVD Time Based Particles play the whole DVD back but with out any control over navigation, seeking, skipping etc.  It is using the "MS DVD Navigator" filter. 

Matts discussion at the time was that DVD Particles do not use the DVDNavigator so they can directly play the content. 
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 04:43:10 pm
You had the answer - Album had to be set for the top file.   So now I'm pushing down File Type, Media Type, Media Sub Type, and pushing up Album.  I've attached an updated Particlizer - unzip and place it in Scriptlets.  It also now warns of missing fields in the file list.

New Particlizer sort of worked:
- The push down of File Type, Media Type, Media Sub Type is great!
- The push up of Album is also good buy you may need to also push up/down Artist (as to me they are still different groupings),
- Filename was auto changed again by MC....(could be the above?)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 04:50:37 pm
...I think this issue will go away if the particles are created from the MediaInfo call as the meta data will be the same
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 04:57:38 pm
I pushed down "Artist" so that it became one album in MC and the ran Particlizer.  No problems with file renaming.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 05:03:13 pm
Strike that - they just renamed (tested a couple of times)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 05:15:55 pm
More Testing.  It is just the "Name" Field that causes this file renaming behaviour and it just may be the "order" in when the name is changed, eg

If I change the name of all of the dummy files to "The Rolling Stones Eoms" then run Particlizer it is fine.  I can then change the "Name" once they are particles to anything I want and the filename does not change.

I'm guessing that the particles have to be created first and must have the same "Name".  Post he creation of they can be renamed.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 23, 2014, 05:55:46 pm
Sorry, how do I tell MC which MPLS to use?  The ripped BD isn't playing (Something went wrong with playback).  Maybe its a copy protection thing.  MC ripped the BD, but it doesn't seem to play.  I know I've used AnyDVD in the past, but that was on a trial basis, so no license here.

Edit: installed AnyDVD and started re-ripping.  Sigh.

Edit: Now we're BD'ing.  Yeah.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 07:43:33 pm
Yeah - so what I'm thinking for the workflow once the BD is ripped (  ;D )

1) Use MC's "Auto Create BD/DVD Title Particles" to create an enties in MC with the format of "...The Rolling Stones Eoms\BDMV\PLAYLIST\00000.mpls" instead of "...The Rolling Stones Eoms\BDMV\index.bluray;1"  This is important as the Chapter Information pulled from Media Info is associated with each of the "mpls" not the main Bluray (and some disks have multiple MPLS with different content in the other MPLS though most have a single MPLS for all songs).

2) We then select the MPLS based particle as the source to create the Dummy Files using MediaInfo for each chapter

3) We then update the meta data from one of the scrapers.

Thanks
Nathan


Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 23, 2014, 07:52:11 pm
So it looks something like this
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 05:29:36 pm
So it should look something like this?  Download and play:

    https://dl.dropboxusercontent.com/u/87189402/Particles%20from%20BD.mp4 (https://dl.dropboxusercontent.com/u/87189402/Particles%20from%20BD.mp4)

 :D

There is a new scriptlet called GetBDChapters.  It is a two stage scriptlet.  The first time you call it, it does the mediainfo lookup on the mpls, creates the dummy files and imports them for you into MC.  For the next stage, you select the mpls and the dummy files, and it calls Particlize to create the chapter particles.  You may have noticed in the movie that the dummy files and mpls file are not sorted in the view.  I made a change to pscriptor to allow scriptlets to sort their inputs, so the order in the view no longer matters.

It also has some code to get all the chapter information for an entire BD rip, but this part is not complete yet.  I started working on that yesterday before I read your desired workflow.  It was going to figure out the MPLS for you including how many chapters are in each so you can know which one to select.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 05:41:36 pm
Yes - exactly like that!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 05:51:57 pm
It also has some code to get all the chapter information for an entire BD rip, but this part is not complete yet.  I started working on that yesterday before I read your desired workflow.  It was going to figure out the MPLS for you including how many chapters are in each so you can know which one to select.

I'm not sure how well this would work in practice as the authoring on some BD's are just bizarre (such as multiple MPLS for the same content so you would end up with lots of dups, or a big list of entries from "junk" MPLS that are full of copyright, directors comments etc etc).

I'd suggest that this could be a phase 2 to see how well it could be automated.  I'd propose that I'll run the "MC Auto Create BD/DVD Title Particles" (to create MPLS) -->  "MrC GetBDChapters Autoworkflow" (to create Chapter Particles on the MPLS) --> "MrC MetaData Taging" on my collection and report back on issues and any ideas to combine, simplify the workflow.

Thanks for doing this.  I take it the calls to Media Info where fine?

Nathan
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 06:12:21 pm
Here is a pre-release or pscriptor you can start working with.  It will take a bit to setup.  Read the comments in the MakeBDChapters scriptlet, and those in the Particlize scriptlet (you're probably setup already with this part).

You'll want to copy the config variables on the config file for the MakeBDChapters section into your custom config file, and customize them appropriately.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 06:15:32 pm
I just added some more comments to the scriptlet which you'll need:

# An example command line is:
#
#     perl pscriptor.pl -E MakeBDChapters -f "tmp field" --filekey
#
# The field 'tmp field' is used in phase 1 to store the chapter playback range information
# in the mpls file for later retrieval in phase 2.  You can use any field you like, and
# the field must be in the file list.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 06:51:45 pm
I must be doing something wrong.

I'm running "perl pscriptor.pl -E makeBDChapters -f dummyfield --filekey" over an MPLS and it run without any errors but I don't see any resultant files created in Windows.  I see in your movie you run a slightly different cmd.

Here is my custom config
Code: [Select]
# Config file for pscriptor.pl

MCWS_server:   localhost:52199
MCWS_username: xxxx
MCWS_password: xxxxx


# MakeBDChapters
MakeBDChapters::Var: exe_path_win = C:\Users\Nathan\Downloads\MediaInfo_CLI\mediainfo.exe # path to mediainfo executable for Windows

# MediaInfo options
GetMediaInfo::Var: exe_path_win = C:\Users\Nathan\Downloads\MediaInfo_CLI\mediainfo.exe # path to mediainfo executable for Windows
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 07:05:33 pm
Sorry, I changed the name of the scriptlet last minute, but forgot to change the variable names both inside the scriptlet and in the config file.  You'll need the new MakeBDChapters scriptlet and update the variables (one which had a typo) in the config file (copy to your custom config and modify), removing the old GetBDChapter variables.

The update is in the attachment above.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 07:15:59 pm
Mmmm same thing (and the vars look the same).  There are two attachments in the post above with the same name but I'm trying the bigger of the two (I think it is the latest as it has a larger file #....)
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 07:39:31 pm
Sorry. Out right now. Edit the script an configuration, replacing GetBDChapters with MakeBDChapters, and correct the spelling typo in basedir.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 08:16:11 pm
Scanned through the config and scriptlet files and they look OK to me, so I'll wait till your back!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 08:17:55 pm
...I did also notice that the Scriptlet folder has a ".MakeBDChapters.pm.swp" file
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 09:39:10 pm
I'm back.  Went out for some Spanish Paella (http://en.wikipedia.org/wiki/Paella).

I downloaded the large of the two archives from above, and it works fine.  Add the -v -d options to see what's going wrong for you.  I suspect your basedir is not set.  Did you fix my typo in the config file.  This is what you should have:

MakeBDChapters::Var: basedir                    = $DESKTOP              # basedir for dummy files folder ('$DESKTOP' => Desktop folder)

Also, I assume you replaced your entire pscriptor folder with the new one above, and then just moved your custom config file into the new folder.  To make this work, I had to change the main pscriptor code, some MCUtils modules code, and about 1/2 of the scriptlets.

The .swp file is just a temporary file my editor makes while I'm editing - you can toss/ignore it.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 09:49:23 pm
Mmm - Good dinner?

Code: [Select]
C:\Users\Nathan\Desktop\pscriptor>perl pscriptor.pl -E makeBDChapters -d -v -f d
ummyfield --filekey
main                : Command Line: -E makeBDChapters -d -v -f dummyfield --file
key
do_mcc_command      : 21000: Sending: http://localhost:52199/MCWS/v1/Control/MCC
?Command=21000

C:\Users\Nathan\Desktop\pscriptor>

Code: [Select]
# MakeBDChapters
MakeBDChapters::Var: exe_path_win = C:\Users\Nathan\Downloads\MediaInfo_CLI\mediainfo.exe # path to mediainfo executable for Windows
MakeBDChapters::Var: basedir = $DESKTOP\DummpFiles # basedir for dummy files folder ('$DESKTOP' => Desktop folder)

# MediaInfo options
GetMediaInfo::Var: exe_path_win = C:\Users\Nathan\Downloads\MediaInfo_CLI\mediainfo.exe # path to mediainfo executable for Windows
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 09:51:37 pm
So I deleted everthing (but my custom config file pasted above) and added the files that I had downloaded from the bigger file.  Other scripts work.  I'm wondering is it is an issue calling MediaInfo, as in looking at the scripts I was wondering if the path was hard coded (so tried copying Media info to various folders but no change).

Edit - it is actually the seperate discogs that works fine in creating the dummy files.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 09:54:28 pm
Typo:

   perl pscriptor.pl -E makeBDChapters -d -v -f dummyfield --filekey

I'll get some code in there error out on this.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 10:01:31 pm
woops!  no idea it was case sensitive - stuff being created!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 10:07:21 pm
Yup, they are.  Perl finds them case insensitively, but I have to convert the scriptlet's name literally into what are called package variable names, so I can lookup the scriptlet's callbacks.  These *are* case sensitive, so this error slid by the statement that loads the module.  I've added code to warn and die when this happens.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 10:11:13 pm
 ;D  ;D  ;D Success with Part 1 and Part2!  I've been called to Lunch so will test after that but what View are you using to keep the temp files grouped with the main particle (eg nothing is being flowed down at that point?) so you can run Part 2 easilly?  (I just manually tagged the temp files)

Thanks
Nathan
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 10:12:15 pm
You don't need to group or sort the files anymore.  The MakeBDChapters scriplet sorts its file list for you.  Just select the 1.mp3 - N.mp3 and the mpls.

Yes, dinner was very good.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 10:33:54 pm
I'm not sure I understand (what news!).  In you clip - the dummy files are being added in the view you have (not sure what it is), but for me this does not happen (I had created a view previously by Discogs) - see pic.  The files are added to MC just fine but not to the view I launched the script from.  Does that make sence?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 10:35:34 pm
Yes, dinner was very good.

I can't remember what lunch just tasted like I bolted it down so quickly!  ;D
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 10:36:59 pm
See the attached screenshot.  I include files that are in either of those two folders.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 11:03:12 pm
First test looks very very good (see pic):
- Particles created properly (no renaming problem),
- Playback range is spot on (and correct number of tracks)
- Pulled the names from discogs just fine using "perl discogs.pl -c discogs-config.txt -i name --mediatype Video --filekey"

The only comment I'd have at this stage on the workflow is around the Stage 1 --> Stage 2 views.  During the first pass of MakeBDChapters scriplet would it be possible to roll down the Meta Data as most people would be using a std view to see their BD and the dummyfiles will not appear.  It is unlikely they would want to create a view as yours for each disk to process.

Off to test some tougher BD!

Well done MrC - I need to send you a beer somehow!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 11:06:38 pm
Thanks.

As for the view, there has to be a customized view to include the FileKey, and Stack * fields anyway.  While you can just add those to an existing view, it seems reasonable to just include the Filename (path) rule that also includes the dummy file folder.

I could certainly push more fields downward if they exist.  Which fields should be included?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 11:19:36 pm
One of the things that the other mode will eventually do (the one where you select the main index.bluray;1 file) is to not only create the title particles like MC does, but it will also return the number of chapters in these too so that it might help guide towards the correct mpls to use.

Its still going to be a two stage operation, because I have no way to select files for you, and and that's the entire basis for getting the track data into pscriptor.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 11:40:38 pm
Here is a second test.  This was is much harder as it is Adele's Live at the Royal Albert Hall and on the BD they had many more tracks than what is listed on Discog as they tried to put much of her between song dialogue as separate chapters to the actual songs.  This is an example of where the "old" method of using track lengths pulled from Disogs failed miserably.  So For this one, I had to play each of the particles to see what each track actually was.

PS - I don't like this album much as it is a conversation for much of the album and she just swears all the way through it.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 11:46:50 pm
Thanks.

As for the view, there has to be a customized view to include the FileKey, and Stack * fields anyway.  While you can just add those to an existing view, it seems reasonable to just include the Filename (path) rule that also includes the dummy file folder.

I could certainly push more fields downward if they exist.  Which fields should be included?

The problem is I have 500 BD's rips (+ particles) all in one folder called "Disks" of which some are Music Videos so even if I added the dummy folder it will be a very long list to pick the individual items out for the second pass.  Can you push down the Meta Data in the first pass instead of the 2nd?  Most should be OK to push down at this point with potentially the exception of Media Type to Video (from memory I don't think MC cares if the Media Type is wrong as long as you don't try to play it).

Thanks
Nathan
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 11:54:02 pm
One of the things that the other mode will eventually do (the one where you select the main index.bluray;1 file) is to not only create the title particles like MC does, but it will also return the number of chapters in these too so that it might help guide towards the correct mpls to use.

Its still going to be a two stage operation, because I have no way to select files for you, and and that's the entire basis for getting the track data into pscriptor.

Understand.  Some of the MPLS are rubbish (and are not presented in MC during normal playback), eg:
* Exile on Main Street has 2: 00000 contains all the songs, 00001 is just for the Menu Screen
* Adele Live has 4: 00000 contains all the songs from the concert, 00002 is an 8min backstage video, 00003 is some backgroud music and still clips of Adele,  00004 seems to be same as 00003.  There is no 00001

I'll keep reporting back on what I find as it may simplify the logic if there is no worthwhile content on anything other than 00000
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 24, 2014, 11:54:48 pm
...also is all this particles stuff polluting your pscriptor thread (eg do you want a new thread)?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 24, 2014, 11:58:41 pm
Can you push down the Meta Data in the first pass instead of the 2nd?

No, because the files are not yet in MC, and are not yet selected.  The only way would be to get metadata into the files before they are imported, and I don't want to get into tag writing.

Or maybe I can create an MPL and import that.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 25, 2014, 12:10:24 am
The problem is I have 500 BD's rips (+ particles) all in one folder called "Disks" of which some are Music Videos so even if I added the dummy folder it will be a very long list to pick the individual items out for the second pass. 

Would it work to use Search to select only the files you are working on?  I just typed "exile" in Search, and that limits the # of files! since I include the album name in the temporary files directory.  That's why I include dead it, by the way.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 12:33:11 am
Yeah that will work for now (Exile cuts it down to about 50 files).  Let me try a couple.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 04:45:42 am
Here is the next one (sorry for the gap - dinner guests!).  Bit more complicated, Pink Funhouse Tour (another disc not worth the money IMO except we where at this concert... the concert was good by the recording is not great).  Wikipedia  (http://en.wikipedia.org/wiki/Funhouse_Tour:_Live_in_Australia#DVD_.2F_Blu-ray_track_listing)has the right track info (except one of the specials is in the wrong order), but both Discogs  (http://www.discogs.com/PNK-Funhouse-Tour-Live-In-Australia/release/2098530)and AllMusic  (http://www.allmusic.com/album/release/funhouse-tour-live-in-australia-mr0001574976)are wrong so I just updated the "Name" by hand.  It is more complicated as:
- 00000.MPLS contains 22 chapters that corresponds to the songs (the 23rd is and odd 1 sec chapter and I'll delete it) which I ran MakeBDChapters over
- 00001&00002 contain 1 bonus track each so no need to run MakeBDChapters
- 00003&00004 contain 1 bonus extra so again no need to run MakeBDChapters
- 00005 contain the "On Tour With Pink" with a heap of chapters but you would not want to run MakeBDChapters over this
- 00006,7,8,9 contain Logo's, Warnings, the Menu etc so you don't want these at all.  In MC these are not even presented as options but I don't know what criteria LAV users to hide these ones as some are 10mins long (eg the Menues).

Overall, working well!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 05:09:10 am
Got one that fails - Amy Winehouse Back to Black BD Pure Audio.  It is authored differently with a separate M2TS file for each of the 11 Songs.  While MC/LAV present them as chapters, Media Info presents then as different Videos (#1 to 11) with only 1 chapter in it's output.
Code: [Select]
General
Complete name                            : \\MAIN\Media\Discs\Amy Winehouse Back To Black\BDMV\PLAYLIST\00000.mpls
Format                                   : Blu-ray Playlist
File size                                : 1.66 KiB
Duration                                 : 34mn 50s
Overall bit rate mode                    : Variable
Overall bit rate                         : 6 bps

Video #1
ID                                       : 4113 (0x1011)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, GOP                     : N=1
Codec ID                                 : 27
Duration                                 : 3mn 33s
Bit rate mode                            : Variable
Bit rate                                 : 36.6 Mbps
Maximum bit rate                         : 40.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 24.000 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.735
Stream size                              : 932 MiB (81%)
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
format_identifier                        : HDMV
Source                                   : 00000.m2ts

Video #2
ID                                       : 4113 (0x1011)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Format settings, GOP                     : M=3, N=18
Codec ID                                 : 27
Duration                                 : 4mn 18s
Bit rate mode                            : Constant
Bit rate                                 : 21.4 Mbps
Nominal bit rate                         : 15.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 24.000 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.430
Stream size                              : 659 MiB (73%)
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
format_identifier                        : HDMV
Source                                   : 00002.m2ts

Video #3
ID                                       : 4113 (0x1011)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, GOP                     : N=1
Codec ID                                 : 27
Duration                                 : 2mn 32s
Bit rate mode                            : Variable
Bit rate                                 : 36.1 Mbps
Maximum bit rate                         : 40.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 24.000 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.726
Stream size                              : 656 MiB (81%)
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
format_identifier                        : HDMV
Source                                   : 00003.m2ts

Video #4
ID                                       : 4113 (0x1011)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, GOP                     : N=1
Codec ID                                 : 27
Duration                                 : 3mn 11s
Bit rate mode                            : Variable
Bit rate                                 : 36.2 Mbps
Maximum bit rate                         : 40.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 24.000 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.726
Stream size                              : 824 MiB (81%)
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
format_identifier                        : HDMV
Source                                   : 00004.m2ts

....etc....

Menu
00:00:00.000                             : Chapter 1

Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 05:28:41 am
Another fail.  Sex Pistols - Never Mind the Bollocks (http://www.allmusic.com/album/release/never-mind-the-bollocks-heres-the-sex-pistols-deluxe-edition-mr0004068982).  MC/LAV shows all 30 chapters but Media Info is only pulling the first 16 related to the first M2TS.  The other chapters are in the second M2TS.  This is a limitation of Media Info.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 06:16:41 am
This one is epic weird.  Green Day - Awesome as F**K.  
- 00000/01000.mpls: Background Menu
- 00001.mpls: 1 Chapter for the whole concert
- 00002/01002.mpls: 1 "Bonus Song"
- 00003/01003.mpls: FBI Warning (hidden by MC/LAV)
- 01001.mpls: 19 Chapter for the Concert (this is the one we want)

The really weird bit is MakeBDChapters worked fine in 01001 but, as you can see in the pic, as I started naming them MC started changing the Filename!

I've tried 3 times, and it is the same.

Of course this breaks playback and I have no idea why MC would do this.  Bug?

Edit - I'll leave this one till tomorrow and try again as it stopped change the file name after a certain point on the 3rd test.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 06:38:59 am
So after today's testing I'd summarise it as:
- Basically works well in generating the correct number of Particles and their Playback Range for a given Playlist (mpls) and this alone saves heaps of time and effort
- MC/LAV is more reliable in reporting Chapters for a Playlist than Media Info (in cases where the content is split over multiple M2TS files)
- Meta data from Discorg and AllMedia is generally unreliable (so you need to enter your own names)
- BD Authoring is all over the place, you can not rely on a particular Playlist, you have to play them and see what is the correct one (note: MC/LAV tends to pick the correct one)

Thanks again MrC.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 06:45:38 am
As an idea... Instead of calling Media Info, Hendrik may be able to advise on how to progamatically call LAV for the Chapter information + it is already installed and would be consistent with what we see in MC.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 25, 2014, 12:15:45 pm
If there is a command line interface to LAV to get this info, I'm happy to use it.

When you get a fail, since I don't have your disc material, I'd need an archive of separate mediainfo --full runs on each mpls, and a recursive directory listing of the BDMV folder.  If you can create that and attach (or email me) the zip file, I'll see what can be done.

It occurred to me last night, and I have not tried this, that you might be able to save an MPL with the FileKey column instead of the Filename column, and MC might be able set your data from those.  If MC can use the FileKey in MPL, then you might have a way to save your particle data.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 05:52:34 pm
I guess Hendrik can advise on LAV and I assume there is a cli (but ....?).

I'll package up a few later today and send them though, but it was more looking for any common patterns / use cases.  The hard bit is going to be finding how to get mediainfo to report all the chapter on those authored with one MPLS for multiple M2TS.

Thanks
Nathan
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 09:56:03 pm
It occurred to me last night, and I have not tried this, that you might be able to save an MPL with the FileKey column instead of the Filename column, and MC might be able set your data from those.  If MC can use the FileKey in MPL, then you might have a way to save your particle data.

That would also be very good!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 25, 2014, 10:11:33 pm
When you get a fail, since I don't have your disc material, I'd need an archive of separate mediainfo --full runs on each mpls, and a recursive directory listing of the BDMV folder.  If you can create that and attach (or email me) the zip file, I'll see what can be done.

Better still here are zip files for the two fails that contain a copy of the MPLS + a directory listing (note: you can use Media Info on the MPLS without needing the actual media files).  

FYI - madshi's eac3to also list the correct chapter names and durations for these disks (but you need the whole disk with media files for this to work not just the mpls)

Edit: I've also posted a Q on the syntax to extract chapter information using ffmpeg over on the Zeranoe build forum as this "should" return the same result we see from MC.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 26, 2014, 12:13:06 am
Also... Have you seen these guys? - http://chapterdb.org/

BD, DVD chapter marks and names with a user submitted GUI and Website listing + API.  Their meta data is much better than the others, eg have a look at the Adele  (http://chapterdb.org/browse/34966)on, it lists all the chapters including the "speaking" parts.  Their timecodes seem to match mine as well.  Not perfect as some BD's are not on their yet, and some have been uploaded without chapter names but overall pretty good.

I had a look a couple of years ago when first looking for a solution to this and at that time there was not much on the site but it has really grown (I'll grab an account and have a play with the GUI - but it may be a service that can be used to pull (and push to) a bit like YADB.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 26, 2014, 01:47:13 am
When you save the file it does two things
1) Submits it to the ChapterDb Database and
2) Saves a txt file out (attached)

So I'd say this is the best source of Meta Data out there at present and if an entry is not available it is easy to create one.  So, this gives us another options:
- Create particles based on the lookup from ChapterDb --> http://chapterdb.org/browse/112983 either by scraping the website using the same method that you first wrote for Discogs Release ID / AMG Album ID, but know you have a ChapterDb ID (or the unique Hash created for each MPLS).  If an item is not their the user would need to use their GUI to first fill it out, or
- Have the users create the text files (attached) using their GUI and then parse that to create the particles
- Use their API for the website to get and sumbit the details as well.

Some things I don't like is you have to have a Google, Facebook, Yahoo account to create your account and get a unique database id that is used by their GUI (and if you want to make direct API calls).

Thanks
Nathan

Note: I had to add ".TXT" to the chapter file to attach it, the file as saved is "Sex Pistols - Never Mind The Bollocks (Pure Audio).chapters"
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 26, 2014, 03:32:34 pm
Got one that fails - Amy Winehouse Back to Black BD Pure Audio.  It is authored differently with a separate M2TS file for each of the 11 Songs.  While MC/LAV present them as chapters, Media Info presents then as different Videos (#1 to 11) with only 1 chapter in it's output.

For this disc, MC shows them as individual chapters, with the correct durations, etc.?  So there's nothing to be done here?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on May 26, 2014, 04:01:41 pm
On this disk the MPLS points one of each of it's chapters to a different M2TS file (instead of one).  So in MC you play the BD and each song is still present as a chapter with a playback range as normal, so it still needs to be broken up by particle.  Unfortunatly, MediaInfo does not report these chapters (only those associated with the first m2ts).  

Likewise the other fail has one MPLS with 30 chatpers, half point to the first M2TS and the rest to a second.  MediaInfo shows the chapter info for the first half only.  I this is just a bug in MediaInfo as other progs have no problem with pulling all the chapter info (I'll ask the Q on sourceforge).

These are the ones I attached the directry sttruction and MPLS

edit - posted the bug? report for Media Info - https://sourceforge.net/p/mediainfo/discussion/297610/thread/e781b09e/
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: arin on May 27, 2014, 10:11:38 am
Hi MrC,
here I am again!

I was trying the GetCoverArtSize scriplet and after installing the Image::ExifTool I was getting nowhere…

I go:
$ perl pscriptor.pl -E GetCoverArtSize -f comment -v

and always get something like:
File: /Volumes/Server10/iTunes Media/Music/A Girl Called Eddy/Tears All Over Town/01 Heartache.m4a
   in(comment): ''
   old=new(comment): <unknown>   field(comment) UNCHANGED: null value returned from script


Can you please tell me what I am missing?
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 27, 2014, 11:35:40 am
Is the cover art inside the media file (embedded)?

Never mind.  I see the same with m4a files.  I'll take a look.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: arin on May 27, 2014, 11:38:27 am
Yes it is!
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on May 27, 2014, 11:58:36 am
Attached an updated GetCoverArtSize that supports m4a.  Unzip and place the .pm file in your Scriptlets folder.  Thanks for reporting this.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: arin on May 27, 2014, 04:01:36 pm
Thanx a lot!
I will try it in the next few days and let you know.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on June 05, 2014, 12:05:40 pm
I've posted version 1.15.  Big update, that includes the ability to make chapter particles out of Blu-ray discs.  User jmone has offered to write up a workflow and usage HowTo.

Version 1.15
    - Fix: problem double utf8 encoding the Filename value being passed to MCWS.
    - New: option --filekey allows using the FileKey() value instead of the Filename.  This is
      useful when you are setting values for non-file backed MC entries such as particles.  To use
      this, add a file list expression column named Filekey and use the expression Filekey() as the
      expression value.
    - New: scriptlet MakeBDChapters creates particle-based chapters from a Blu-ray mpls file.  This
      scriptlet uses the ChapterDB site for disc lookup (either automatically or from a ChapterDB
      browse ID for the selected mpls playlist file).  If the MD5 lookup fails, MakeBDChapters will
      fallback to using the MediaInfo utility if installed to pull chapter information (this is not
      always reliable).  MakeBDChapters will create some necessary dummy files, imports them into MC,
      and then call the Particlize scriplet do do the particlization.  Read the comments at the top
      of the script, and the top of hte Particlize script for configuration requirements and view
      setup.  See the important Notes.
    - New: scriptlet Particlize creates particles out of dummy files which were created by amg.pl,
      discogs.pl and MakeBDChapters.  This allows you to create chapters or virtual splits in long
      media files, based on title and duration information found on amg or discogs. The scriptlet
      deletes the dummy files upon exit, leaving only the particles in place.
    - New: a scriptlet's do_preprocessing routine can now return a reference to a modified
      tracklist.  This allows, for example, winnowing or sorting the tracklist.
    - Fix: produce error and die on scriptlet name typos.
    - Fix: GetCoverArtSize failed to get the artwork size for m4a files.
    - Internal: MCUtils/MPL module now being used, replacing older MPL writing code.
    - Internal: HTTP page pulls are now handled by the MCUtils/HTTP.pm module.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on June 09, 2014, 05:19:36 pm
A quick update to fix a bug when using MakeDBChapters:

Version 1.16
    - Fix: track Name entries that were double quoted were being incorrectly encoded in the
      saved XML, causing those entries to inherit the generic "Chapter #" name.
    - Internal: moved HTML decoding out of shared MCUtils/MCWS.pm module.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: MrC on June 13, 2014, 10:34:28 pm
I've posted Version 1.17, which adds a couple new options to MakeBDChapters, and better parses MediaInfo output for certain BDs.

Version 1.17
    - New: scriplet MakeBDChapters has two new options 'check' and 'submit', supplied via -a.
    - Fix: scriplet MakeBDChapters better handles pulling chapter data from MediaInfo.
    - Internal: mention HTTP page get failures only in verbose mode (MCUtils/HTTP.pm).
    - Internal: mention chapterdb lookup failures only in verbose mode.
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: audiocrazy on May 17, 2015, 04:22:00 pm
There is no MakeBDChapters.bat file in Pscriptor_1_17 install. Where do I get it.
I tried all downloads and none of them contains MakeBDChapters.bat file.
Where do I download MakeBDChapters.bat?

I run this command perl pscriptor.pl -E MakeBDChapters -f "dummyfield" -v --filekey -a check
But since MakeBDChapters.bat is missing it get this message

"File: 384269: F:\Video\Chris Botti In Boston\CHRIS_BOTTI_IN_BOSTON\BDMV\PLAYLIST\00003.mpls
        in(dummyfield): ''
        old=new(dummyfield): <unknown>  field(dummyfield) UNCHANGED: null value returned from script"
Title: Re: pscriptor.pl: a general purpose scriptable MC field manipulator + utility
Post by: jmone on September 26, 2015, 07:33:34 pm
This thread has been locked and while it contains useful additional info, the script utility has been removed and is now superseded with the single MCUtils script package (http://yabb.jriver.com/interact/index.php?topic=100449.0)