Firmware: A-410 [01 Apr. 2014] | A-400 [12 Mar. 2014] | C-300 [13 Feb. 2014] | A-300 [24 Feb. 2014] | C-200 [11 July 2013] | A-200/A-210 [11 July 2013] | Popbox V8 [3 Dec 2013]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals



User(s) browsing this thread: 1 Guest(s)
Thread Closed 
pchPls - Java PCH Playlist Generator
03-28-2009, 01:13 PM (This post was last modified: 03-29-2009 02:54 AM by skafoelix.)
Post: #1
Lightbulb pchPls - Java PCH Playlist Generator
Hi everyone!

Here's a small java app I wrote for automatic playlist generation on the PCH (should work on any other NMT too).

Short features description:
- Command line based, so it can be automated. (eg. schedule it to run every night or every hour, or whatever you like)
- Can scan only one directory or run recursively through all directories down the tree
- One can set the included file types (eg. if you only want mp3's to be scanned)
- Can exclude directories and files
- When run it tells you which folders/files it scans, adds or skips
- It's fast! (in my case it takes about 20 seconds to scan 30.000 files)
- It's small! (the binary version is only about 60kb)
- Works with mika!!!

What it (currently) does NOT do:
- Sort the playlist (I use the playlist only in conjunction with the shuffle.php of Music Jukebox so I don't need the jsp to be sorted but it could be a future feature)
- Shuffle the playlist (As I said above, I use shuffle.php)
- Create playlists for every scanned folder
- There's not much error handling yet
- No logging to file (but you can easily create a shell or batch script for that)
- You can not change the location the output file will be created in, but you can change the name with the -o argument

Usage: (just run java -jar pchPls.jar to see the usage info)
Code:
Usage: java -jar pchPls.jar
        -m|--mediaRoot <MediaRootDirectory>
        -p|--pchRoot <PchMusicDirectory>
        [-o|--outFile <OutputFileName>]
        [-r|--recursive]
        [--fileTypes:<IncludedFileTypes>]
        [--excludeDirs:<ExcludedDirs>]
        [--excludeFiles:<ExcludedFiles>]

  -m|--mediaRoot <MediaRootDirectory>
        The root directory where your media is stored.

  -p|--pchRoot <PchMusicDirectory>
        The root path to your music directory on the Popcorn Hour.

  -o|--outFile <OutputFileName>
        The filename of the resulting playlist file. (default: playlist.jsp)

  -r|--recursive
        Requests that all directories under the root should be scanned. (default: false)

  --fileTypes:<IncludedFileTypes>
        Comma separated list of file types that will be included.
        (default: aac,m4a,mp1,mp2,mp3,mpa,wav,wma,flac,ogg)

  --excludeDirs:<ExcludedDirs>
        Comma separated list - Directories containing one of the specified strings will be excluded.

  --excludeFiles:<ExcludedFiles>
        Comma separated list - Files containing one of the specified strings will be excluded.

Usage examples:
java -jar pchPls.jar -m "/media/pch/Music/" -p "file:///opt/sybhttpd/localhost.drives/HARD_DISK/Music/" --excludeDirs:"lastfm-cli-cache","_" -r
-m sets the root folder where my media is. On windows you simply set the drive letter where your music is + the subdirectory. So it might just be "P:\Music\".
-p sets the root path to your media library from the pch. If your media is on a network share you have to change the path accordingly.
--excludeDirs:"lastfm-cli-cache","_" tells the application to skip all directories containing the string "lastfm-cli-cache" and all directories with a "_" in the name.
-r tells the app to run recursively through all folders under the media root.

Tips:
- Excluding files works the same way as excluding directories
- To include certain file types simply use --fileTypes:mp3,wma,...,... Don't use dots before the extensions!
- To set the output file name use -o FileName.jsp

Download:
V1.1 Binaries
V1.1 Source (NetBeans Project)
Find all posts by this user
03-28-2009, 04:41 PM
Post: #2
RE: pchPls - Java PCH Playlist Generator
Nice work. Seems like it could be a nice companion with mika to run straight on the NMT, or does it have a dependency to recent Java versions?

Audio, video, disco - I hear, I see, I learn.
Wiki. Wiki? Wiki!
Find all posts by this user
03-28-2009, 08:31 PM
Post: #3
RE: pchPls - Java PCH Playlist Generator
Haven't had a look at mika yet but I will do so in the next days.

I'm a professional c# developer but I'm still quite new to java so I don't know if I use any new java language features.
It's build against JDK 1.6 and I make use of generics in some places which "might be" a relatively new feature but I could easily replace those lines.
Find all posts by this user
03-28-2009, 08:35 PM
Post: #4
RE: pchPls - Java PCH Playlist Generator
I think Mika only supports Java 1.3 (don't quote me on that). Generics came in with Java 1.5 so unlikely to be supported in Mika.
Find all posts by this user
03-28-2009, 08:41 PM
Post: #5
RE: pchPls - Java PCH Playlist Generator
(03-28-2009 08:35 PM)bellissimo Wrote:  I think Mika only supports Java 1.3 (don't quote me on that). Generics came in with Java 1.5 so unlikely to be supported in Mika.

Yeah I thought that generics would be relatively new in java just as in ms .net.
Well, I'm right now installing mika and will do some tests with it.
Then I might convert those generics and use something not so shiny. Wink Let's see...
Find all posts by this user
03-29-2009, 02:57 AM
Post: #6
RE: pchPls - Java PCH Playlist Generator
Ok, it was a lot more work than I expected but I got it working with mika on my pch!!
It's of course not as fast as on a pc but it could still be nice to run it scheduled every night on the pch.
And that's what I'm gonna try tomorrow. Wink

The links above are updated to point to V1.1.
Find all posts by this user
03-29-2009, 08:34 AM
Post: #7
RE: pchPls - Java PCH Playlist Generator
Excellent!

Audio, video, disco - I hear, I see, I learn.
Wiki. Wiki? Wiki!
Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  PCH Audio playlist format? Nono 4 2,368 10-05-2011 10:10 PM
Last Post: Nono
  Wifi On/Off switch project with Java Mika gozothegreat 11 5,900 09-02-2010 08:07 AM
Last Post: gozothegreat
  Which box for Java/Mika development kiffer 4 2,952 03-24-2010 05:11 PM
Last Post: Willem53
Heart Create mono playlist ? kdavid 0 1,499 03-16-2010 07:17 PM
Last Post: kdavid
  How to play a playlist with Popcorn and Pure Avanti Flow? mystery.tipster 0 3,333 12-29-2009 01:02 PM
Last Post: mystery.tipster
  Script for Random playlist grahams 44 22,492 11-21-2009 07:51 PM
Last Post: haggisbingo
  install java 1.5 or 1.6 on PCH-A110 cerber 6 3,264 07-20-2009 12:44 AM
Last Post: dc11ab
  Automatic Playlist File Generator - Updated 2.16.09- *Version 1.4* excal 298 144,412 07-08-2009 08:56 PM
Last Post: DirkB
  mpd - playlist persistance and overwriting. Mr Segfault 3 4,039 05-28-2009 07:29 AM
Last Post: Mr Segfault
  Running Java applications on the NMT? tiwas 3 2,988 04-13-2009 09:49 AM
Last Post: werner

Forum Jump: