Simple Printout of Database
#1
I would like to produce a simple printout of every video file in my database and the title, preferably to a pdf. Must run on linux.
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
#2
http://forum.xbmc.org/showthread.php?tid=158373

To get a list of all Movies:

Code:
./texturecache.py j movies | grep '"title":' | cut -d: -f2- | awk '{print substr($0,3,length($0)-5)}'

and TV Shows:

Code:
./texturecache.py j tvshows | grep '"title":' | cut -d: -f2- | awk '{print substr($0,3,length($0)-5)}'

and Songs:

Code:
./texturecache.py j songs | grep '"title":' | cut -d: -f2- | awk '{print substr($0,3,length($0)-5)}'

etc.

How you produce the PDF is up to you...
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#3
Thank you, something to do this evening Smile
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
#4
Another, simpler variation:

Code:
./texturecache.py query movies 'title != ""' | sed 's/^.* \[\(.*\)] .*$/\1/'
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#5
Just something I wrote up in python for myself. Make sure XBMC is running and the "Allow control of XBMC via HTTP" in XBMC's System>Services>Webserver is enabled

Code:
# --------------------
# tvshows.py
# toodlydo
# printout all tv show folder and files up to 3 directories down
# --------------------

import json
import urllib2, base64
import os
from pprint import pprint

f = open('tvshows.txt','w')

rooturl = "http://192.168.0.101:81/jsonrpc"
username = "xbmc"
password = "xbmc"
url1= rooturl + "?request="
url=url1+'{"jsonrpc":"2.0","method":"VideoLibrary.GetTVShows","id":1,"params":{"properties":["title","file","episode"]}}'
#print url;

passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, rooturl, username, password)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)

data = json.load(opener.open(url))

tvshows = data["result"]["tvshows"]
for tvshow in tvshows:
    #print tvshow['label'] + " (" + str(tvshow['episode']) + ")" + " - " + tvshow['file']
    f.write((tvshow['label'] + " (" + str(tvshow['episode']) + ")" + " - " + tvshow['file']+ os.linesep).encode("utf-8"))

    jdata = json.dumps({"jsonrpc":"2.0","method":"Files.GetDirectory","id":2,"params":{"directory":tvshow['file'],"properties":["file"]}})
    req = urllib2.Request(rooturl, jdata, {'Content-Type': 'application/json'})
    data = json.load(opener.open(req))

    folders = data["result"]["files"]
    for folder in folders:
        #print "\t" + folder["file"].replace(tvshow['file'], "")
        f.write(("\t" + folder["file"].replace(tvshow['file'], "") + os.linesep).encode("utf-8"))
        jdata = json.dumps({"jsonrpc":"2.0","method":"Files.GetDirectory","id":2,"params":{"directory":folder['file'],"properties":["file"]}})
        req = urllib2.Request(rooturl, jdata, {'Content-Type': 'application/json'})
        data = json.load(opener.open(req))
        if folder["filetype"] == "directory":
            files = data["result"]["files"]
            for efile in files:
                #print "\t\t" + efile["file"].replace(folder['file'], "")
                f.write(("\t\t" + efile["file"].replace(folder['file'], "") + os.linesep).encode("utf-8"))
                jdata = json.dumps({"jsonrpc":"2.0","method":"Files.GetDirectory","id":2,"params":{"directory":efile['file'],"properties":["file"]}})
                req = urllib2.Request(rooturl, jdata, {'Content-Type': 'application/json'})
                data = json.load(opener.open(req))
                if efile["filetype"] == "directory":
                    eefiles = data["result"]["files"]
                    for eefile in eefiles:
                        #print "\t\t\t" + eefile["file"].replace(efile['file'], "")
                        f.write(("\t\t\t" + eefile["file"].replace(efile['file'], "") + os.linesep).encode("utf-8"))
f.close()

Hope it helps.
PS: I used Python 2.7.5
Reply
#6
I wrote an addon for xbmc that does this also.

It's not finished yet, but works if you want to try it out.

https://www.dropbox.com/s/64xwz8334w223o...er-0.5.zip
Reply
#7
quick reply : the text output Works fine Cosmicr , but the html doesn't. either as only selected, or both.
Reply
#8
@cosmicr

Works well for Text Output in LinuxMint13 x64 'Cinnamon' using XBMC 'Eden'.

Thanks - just what I needed.
Reply



Logout Mark Read Team Forum Stats Members Help
Simple Printout of Database0
This forum uses Lukasz Tkacz MyBB addons.