Playing DVDs by running script
#16
ok so if i run
nohup mplayer dvd://1 -dumpstream -dumpfile /media/LARGEFILES/dvd.mpg 1>/dev/null 2>/dev/null </dev/null & sh play /media/LARGEFILES/dvd.mpg

where play script is
curl -g localhost:8080/jsonrpc?request=\{\"jsonrpc\":\"2.0\",\"method\":\"Player.Open\",\"params\":\{\"item\":\{\"file\":\"$1\"\}\},\"id\":\"1\"\}
from terminal it works perfectly...but if i copy the curl command in play and try to run it directly it doesnt work from terminal...
exact same command as in my play "script"...
[1] 2082
{"error":{"code":-32602,"message":"Invalid params."},"id":"1","jsonrpc":"2.0"}curl: (3) <url> malformed
if i want to run
python default.py
from terminal it works only if i have it setup like this
root@raspbmc:/home/pi/.xbmc/addons/script.PlayDVD# cat default.py
import os
os.system('nohup mplayer dvd://1 -dumpstream -dumpfile /media/LARGEFILES/dvd.mpg 1>/dev/null 2>/dev/null </dev/null &')
os.system('/home/pi/.xbmc/addons/script.PlayDVD/play /media/LARGEFILES/dvd.mpg')

and this will play if i click on the addon 2x, which means there are 2 rips going at the same time...so not good
error:

so somewhere there is a disconnect between the xbmc and the play command...
i tried this, and played it from the xbmc screen

import os
os.system('mplayer dvd://1 -dumpstream -dumpfile /media/LARGEFILES/dvd.mpg 1>/dev/null 2>/dev/null </dev/null &')
import xbmc,xbmcgui
class Main:
def __init__(self):
playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
playlist.clear()
playlist.add('/media/LARGEFILES/dvd.mpg')
xbmc.Player().play( playlist)

m = Main()


success...
it will play if, and only if...
i have the play curl in there 2x, the sleep 10 or sleep 30 or sleep 45 never worked...

import os
os.system('nohup mplayer dvd://1 -dumpstream -dumpfile /media/LARGEFILES/dvd.mpg 1>/dev/null 2>/dev/null </dev/null &')
os.system('/home/pi/.xbmc/addons/script.PlayDVD/play /media/LARGEFILES/dvd.mpg')
os.system('/home/pi/.xbmc/addons/script.PlayDVD/play /media/LARGEFILES/dvd.mpg')
Reply
#17
so...new idea
make a playlist of the largest vobs...
find /media -maxdepth 3 -type f -size +200000000c -name \*.VOB | sort > playlist
and then
nohup mplayer -playlist playlist -dumpstream -dumpfile /media/LARGEFILES/dvd.mpg 1>/dev/null 2>/dev/null </dev/null &
and then
/home/pi/.xbmc/addons/script.PlayDVD/play /media/LARGEFILES/dvd.mpg

but it only plays the 1st vob file in the list...any way i can get mplayer to play them in sequence?
Reply
#18
so is there a way to play multiple vob files from a playlist? i am asking becasue i have a bunch of dvds that have multiple tv series on them, and i dont want to have to wade through finding the right episode i want to watch, i would like to be able to skip to the next vob...
which is why i think something like this could work...
but it only plays the 1st vob it finds, it doesnt go to the next file in the playlist

find /media -maxdepth 3 -type f -size +200000000c -name \*.VOB | sort > playlist
nohup mplayer -playlist playlist -dumpstream -dumpfile /media/LARGEFILES/dvd.mpg 1>/dev/null 2>/dev/null </dev/null &
/home/pi/.xbmc/addons/script.PlayDVD/play /media/LARGEFILES/dvd.mpg
Reply
#19
Rip the damned things and be done with it...

There is not one VOB per title. VOBs have a maximum size (if on a DVD) so there might be a number of VOBs per title.

dvdbackup -I will give a good report on the DVD, what titles it has etc. Some good documentation here

https://wiki.archlinux.org/index.php/Dvdbackup

lsdvd will also give lots of info.

http://linux.die.net/man/1/lsdvd
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#20
hey nickjr...
you actually gave me the help i needed Big Grin lsdvd...
thanks, this works great now...i have to run it as a script, but it does the exact job i wanted...without ripping each dvd to the limited 8gb sd card i have to run my raspberry pi :-)

discinfo=`lsdvd /dev/sr0>/dev/null`
trackNum=`echo "$discinfo" | grep '^Longest track: ' | sed 's/.*: 0*//'`
nohup mplayer "dvd://$trackNum" -dumpstream -dumpfile /media/LARGEFILES/dvd.mpg 1>/dev/null 2>/dev/null </dev/null &
then i sleep 5
then i run the curl as a script, and it works exactly as i had hoped
so thank you for the inadvertent help becasue it actually was a big help since i didnt know about lsdvd
Reply
#21
i now have a script that will read the contents of the dvd and will allow you to pick the title you want to watch and then output it to mplayer via terminal or ssh...
my only problem is i cant seem to get it to work through xbmc...
it only works through terminal/ssh...
can someone help (maybe some sort of python script?) to get it to output the track listing and then be able to input which track you want to the tv screen from xbmc?
as of now, when i run it via xbmc, it defaults to the 1st title only...but works great in terminal/ssh

Code:
root@raspbmc:/home/pi/.xbmc/addons/script.PlayDVD# cat /home/pi/.xbmc/addons/script.PlayDVD/resources/manualchapter.sh
#!/bin/bash
    x=1
    lsdvd | sed 's/Chapters.*//;/00:00:.*/d;/^$/d' | more
    while [ $x ]; do
            echo -n "Enter the track you want (^C to quit): "
            read trackEntry
            echo "you entered track $trackEntry "
                 trackNum=$trackEntry
                 break
done
    set -- $*  
    for i
    do
            if [[ $1 == '-t' ]]; then
               shift;
               echo "Track set to: $1, by you";
               trackNum=$1
               shift;
    fi
done
mplayer "dvd://$trackNum" -dumpstream -dumpfile /media/LARGEFILES/dvd.mpg 1>/dev/null 2>/dev/null </dev/null &
    sleep 5
sh /home/pi/.xbmc/addons/script.PlayDVD/resources/play /media/LARGEFILES/dvd.mpg #curl script
Reply

Logout Mark Read Team Forum Stats Members Help
Playing DVDs by running script0