Re: [Banshee-List] 2.4.0 "grunt" work.



Thanks, I'll get onto that.

@Don:
Here you go -- I don't think it's a feature worth incorporating into banshee, so I didn't
spend much time on it (and I wrote it in python because it's easier for me) but it
does what you want. If you need it in LibreOffice then copy and paste it from the 
dump.txt file yourself :D

If this isn't what you wanted then I'm happy to fix it, but I think it'll suffice for the task
you need it for.

Thomas Stephenson
(ovangle gmail com


On 4 November 2011 04:24, gnomeuser gmail com <gnomeuser gmail com> wrote:
2011/11/3 Thomas Stephenson <ovangle gmail com>:
> Thanks,
>
> I'll see if I can find something to do. I'd prefer it if someone would drop
> me an email
> with some specific tasks they'd want done -- banshee isn't a small
> project and it'd be
> useful to have an entry point into what I'm doing. At least at first...
> Once I've got a
> better idea of how it all fits together I'd be more confident to messing
> around doing
> stuff I want to do, but at the moment I don't know what parts of the source
> serves
> what purpose.
> @David
> I'll have a look at reviewing that patch too. Could you post a link to where
> specifically
> I can find it?

If memory serves me correctly this is oliviers github branch.
https://github.com/dufoli/banshee/commits/video
_______________________________________________
banshee-list mailing list
banshee-list gnome org
http://mail.gnome.org/mailman/listinfo/banshee-list  (unsubscribe here)

#!/usr/bin/env python

# sqldump.py
# ==========
# Prints a list of artists and tracks from the banshee database

import sys, subprocess
import sqlite3
import codecs

def getAlbumsByArtist(cursor, artistid):
    cursor.execute(u"SELECT title, AlbumID FROM CoreAlbums \
                    WHERE artistID={0:d} \
                    ORDER BY title;".format(artistid))
    return cursor.fetchall()

def getTracksByAlbumArtist(cursor, artistid, albumid):
    cursor.execute(u"SELECT TrackNumber, title, TrackID FROM CoreTracks \
                    WHERE artistID = {0:d} AND albumID = {1:d} \
                    ORDER BY TrackNumber;".format(artistid, albumid))
    return cursor.fetchall()

def getDBPath():
    locate_db = subprocess.Popen(['locate', 'banshee.db'], 
        stdout = subprocess.PIPE)
    path = locate_db.communicate()[0]
    if locate_db.returncode == 0:
        return path.strip()
    else:
        print("A banshee database was not found on the system.")

def main():
    path = getDBPath();
    if path == None:
        return
    out = codecs.open('dump.txt', 'w', encoding='utf-8') 
    sql_conn = sqlite3.connect(path)
    cursor = sql_conn.cursor()
    cursor.execute(u"SELECT name, artistID FROM CoreArtists ORDER BY name;")
    artists = cursor.fetchall()
    for artist in artists:
        if(artist[0] != None):
            out.write(u"{0!s}:\n".format(artist[0]))
            albums = getAlbumsByArtist(cursor, artist[1])
            for album in albums:
                out.write(u"\t{0!s}:\n".format(album[0]))
                tracks = getTracksByAlbumArtist(cursor,artist[1],album[1])
                for track in tracks:
                    out.write(u"\t\t{0:d}. {1!s}\n".format(track[0],track[1]))

if __name__ == "__main__":
    main()
   
  


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]