Plex/Nine Database

Are we there yet? Are we? Are we?

Every time I get a notification of a new post here and come check, hoping for some intelligent discorse on life, the universe, and databases, and read another “me too” post, the Alexandria library loses about 30 seconds of development time. Just saying.



I have a real question about Plex 9 then.

I have only starting using Plex recently(version 8.5) and so I have no experience with major new version releases or updates. What will happen to our current libraries and preferences when we upgrade to Plex 9? Will we have to re-scrape everything? Or will Plex 9 recognize our current libraries, thumbs, backdrops, etc.?

This is a MAJOR revision (doesn’t get more major than this), you’ll have to re-create your library.



(This is not to say that a migration app couldn’t be written, we just don’t have the bandwidth to create one.)



Thanks for the fast reply.

I had a feeling that might be the case, but that's cool. My library is only about 100 DVDs so it would not take long to fix it.

Too bad for those people with huge libraries though. :P


It's not that bad. I think one cold and rainy sunday should be enoug to scrape my 500 movies (incl. DVDs) and 1300 Tv-Episodes.
I'm very curious about the Agents in Alexandria, because the Data from Ofdb.de is mostly crap and the possibility to combine the Data from e.g. imdb (Actors, genre, director) and ofdb (plot) makes me laugh, sing and dance! Will it realy be this easy?


All the underpinnings are there, I don't expect it to be fully exposed in the first alpha, but that's EXACTLY the scenario we're targeting. In fact, now that I think about it, I think that would even work fine right now :) We just don't have an OFDB agent yet, but if one existed, and it just returned summary, you could prioritize it above IMDB.

Sing! Dance! Laugh!

I don’t really know if this is the right place to post this, but i try here. Im sorry if im wrong.



Can Plex Nine detect when i add a file to one of my source and update the libary automaticly?



So when my download is finsished it automaticly scrape it.

The folder action, combined with a script that launches the database update, should answer your request.

You can also launch the script from the app you use to download your stuff.

Here is my update script, inspired from a post on this forum:


#!/bin/zsh<br />
<br />
seriesPath=/Volumes/Capsule/Series/<br />
ip=10.0.1.31<br />
<br />
#see if plex is running<br />
#ps lists grep along with any actual instances of Plex.app<br />
numPlexes=$(( $(/bin/ps -A | /usr/bin/grep /Applications/Plex.app | wc -l) ))<br />
<br />
#only call update if Plex is running<br />
if [[ $numPlexes -gt 0 ]]; then <br />
echo updating...<br />
/usr/bin/logger updating Plex library<br />
/usr/bin/curl -o /dev/null --stderr /dev/null --silent --get "http://$ip:3000/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"<br />
fi<br />
<br />
if [[ $numPlexes = 0 ]]; then<br />
echo No Plex running on $ip<br />
fi


Dont worry, PlexNine will save the day ;)

Will 0.9 give us the option to scrape different items from different places? IE Get the movie info from one site and the thumb from another?



Also how will 0.9 handle media flags? Will it perform analysis of my media files for things like resolution/soundtrack etc?



Will we be able to add our own media flags for studios etc or will they all be controlled centrally?



Yes, available in first alpha.



Yes, available in first alpha.



Controlled centrally, but if you care enough you can mark the flags bundle as "dev" and throw your own in there.

Fantastic! I’m hoping then that Plex will simply display all the available info it’s managed to glean for a movie/tv show etc and let me choose.



I’m thinking controlled centrally is the better option to be honest. Will you have things in place to allow users to submit new media flags for approval?







And being totally OT here but any news on when the skinning engine will be “Plexified” to the same extent the rest of it has? (I want a simple skinning engine dammit! :wink: )



This numplexes thing is unnecessary & ugly, and seriesPath never even gets called. Cleaner, more reliable script:


<br />
#!/bin/bash<br />
<br />
#see if plex is running<br />
/bin/ps -A | /usr/bin/grep Applications/Plex.app | /usr/bin/grep -v grep > /dev/null<br />
<br />
#Act accordingly<br />
if [[ $! -eq 0 ]]; then<br />
     #Update Plex<br />
     /usr/bin/logger updating Plex library<br />
     /usr/bin/curl -o /dev/null --stderr /dev/null --silent --get "http://127.0.0.1:3000/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"<br />
else<br />
     #Log failure<br />
     /usr/bin/logger No Plex running on localhost<br />
fi<br />


The seriesPath was used to specify one specific folder to update, but it seems it does not work. So, you’re right, it’s never called. The numplexes checkes if plex is running, so it is usefull.

ok, got a question. i haven’t seen an answer for it anywhere else yet…



one of my main hard drives recently broke, possibly due to a combination of overheating and being constantly on. (wholey because of your fine media playing app i might add!) because of this i’ve invested in a sata hotswap bay so i only have whichever drive i need connected at any one time. will there be features such as hiding any media for which the hard drive/pen drive/disc is not currently mounted? i’d love to only be able to see what’s currently connected while still having my offline files stored in the library ready to pop back up the second i add another drive. perhaps a switch to toggle hiding offline files? it’d still be great to be able to see everything i have, maybe with something like a ‘please insert/your file is located on drive ‘x’.’ secondly and kinda related, because it’s now impossible for me to have all of my media plugged in at any one time i am unable to use the ‘clean library’ feature. is cleaning the library still needed under 9 and if so, would it be possible for me do something like clean the library for only the currently connected sources? this way i could tidy up anything i’ve deleted without removing my whole offline library.



thanks,



marc



There's a few different versions of this script floating around, and I didn't read yours closely enough. This particular variant fires if numplexes > 0, which means it will always fire, even if Plex isn't running, because as written numplexes will always be greater than zero. I'll demonstrate.

Here's an example from a computer that is running Plex:

<br />
Burn-e:~ chip$ /bin/ps -A | /usr/bin/grep /Applications/Plex.app<br />
  555 ??       227:48.42 /Applications/Plex.app/Contents/MacOS/Plex -psn_0_188462<br />
29828 ttys002    0:00.00 /usr/bin/grep /Applications/Plex.app<br />
Burn-e:~ chip$ /bin/ps -A | /usr/bin/grep /Applications/Plex.app | wc -l<br />
       2<br />




Here's an example from a computer that is not running Plex:

<br />
eve:~ chip$ /bin/ps -A | /usr/bin/grep /Applications/Plex.app<br />
 3507 ttys000    0:00.00 /usr/bin/grep /Applications/Plex.app<br />
eve:~ chip$ /bin/ps -A | /usr/bin/grep /Applications/Plex.app | wc -l<br />
       1<br />




So for the script you have posted to work as written, you need to run the update only if numplexes > 1, not > 0 as your ifcase states. However, the whole numplexes thing originated as a workaround for the fact that the ps | grep command as written here will always return itself as well as any Plex instances. For a much cleaner way to deal with this, pipe to grep a second time with -v, the inverse-match argument, and tell it not to match against grep. This effectively filters out grep from the result set, and now we have a shell boolean. Either we will find Plex.app running and return true, or we'll find Plex.app isn't running, and return false. No line counts are needed to create a condition for the ifcase, so we just direct the output to null.

Here's an example from a computer that is running Plex:

<br />
Burn-e:~ chip$ /bin/ps -A | /usr/bin/grep Applications/Plex.app | /usr/bin/grep -v grep<br />
  555 ??       229:33.62 /Applications/Plex.app/Contents/MacOS/Plex -psn_0_188462<br />
Burn-e:~ chip$<br />




Here's an example from a computer that is not running Plex:

<br />
eve:~ chip$ /bin/ps -A | /usr/bin/grep Applications/Plex.app | /usr/bin/grep -v grep<br />
eve:~ chip$<br />




So then, instead of counting the number of results of our grep test, we can just test against true/false, and write the ifcase like so:


<br />
if [[ $! -eq 0 ]]; then<br />




If we really wanted to play script hockey we could combine the grep statement into the ifcase test, but that lowers readability considerably.

(A final note: All this fancy logic to determine whether Plex is running or not isn't particularly necessary, it's just nice. Running an http request against a closed port just makes curl fail, it doesn't have any longterm ill effect.)

So to sum up: Every shell command is already a boolean, and will return either 0 (success) or 1 (fail). Pipe grep back to grep -v grep to filter out grep from its own search results, and then use the success/failure of your command as the boolean for an ifcase rather than kludging linecounts to turn a grep result set into a boolean for testing.

Or, like I said before: This numplexes thing is unnecessary & ugly.

Can we try to stay on topic, please? This thread’s for discussion of the new library database in 0.9, not scripts that update the old library in 0.8 :slight_smile:



Well that's good to hear, this PlexNine really sound like a MAJOR MAJOR update. can we compare it to Leopard to snow leopard? :)


I'd like to compare it more to the move from Windows to the Mac. Things are easier, life is better.