Began migrating to scion 1.1
This commit is contained in:
parent
3bdc08476b
commit
198855211f
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Jan 1, 2010 6:33:06 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
global name, app, type, path, opt
|
|
||||||
name = "create"
|
|
||||||
app = "ocarina"
|
|
||||||
type = "core"
|
|
||||||
path = ""
|
|
||||||
opt = []
|
|
||||||
|
|
||||||
from bt.message import write
|
|
||||||
from bt.file import *
|
|
||||||
from tools import database
|
|
||||||
from manager import manager
|
|
||||||
import settings
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
|
||||||
def open():
|
|
||||||
if settings.has("curlib") == False:
|
|
||||||
settings.set("curlib",-1)
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
return "Used to create a new library"
|
|
||||||
|
|
||||||
|
|
||||||
def library(args):
|
|
||||||
name = "Default"
|
|
||||||
root = ""
|
|
||||||
if len(args) >= 2:
|
|
||||||
name = args[0]
|
|
||||||
#if len(args) >= 2:
|
|
||||||
space = ' '
|
|
||||||
root = expandPath( space.join(args[1:]) )
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
|
|
||||||
if checkDir(root) == False:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Insert the library into the database
|
|
||||||
database.open()
|
|
||||||
next = database.count('library')
|
|
||||||
settings.replace("curlib",next)
|
|
||||||
database.insert('library',(next,name,root) )
|
|
||||||
database.close()
|
|
||||||
|
|
||||||
manager.run("scan",[root])
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(args=None):
|
|
||||||
l = len(args)
|
|
||||||
if args[0] == "library":
|
|
||||||
library(args[1:])
|
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Dec 21, 2009 10:35:01 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
global name, app, type, path, opt
|
|
||||||
name = "load"
|
|
||||||
app = "ocarina"
|
|
||||||
type = "core"
|
|
||||||
path = ""
|
|
||||||
opt = []
|
|
||||||
|
|
||||||
from bt.message import write
|
|
||||||
from bt.file import *
|
|
||||||
import settings
|
|
||||||
|
|
||||||
#from tools import gstream
|
|
||||||
from tools import gstreamer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
|
||||||
def open():
|
|
||||||
pass
|
|
||||||
#write("Example plugin has been changed",True)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
return "Loads a music file"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(args=None):
|
|
||||||
if args == None:
|
|
||||||
return
|
|
||||||
gstreamer.close()
|
|
||||||
if len(args) == 1:
|
|
||||||
gstreamer.load(args[0])
|
|
||||||
else:
|
|
||||||
join = ' '
|
|
||||||
gstreamer.load(join.join(args))
|
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Jan 5, 2010 4:15:27 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
global name, app, type, path, opt
|
|
||||||
name = "lslib"
|
|
||||||
app = "ocarina"
|
|
||||||
type = "core"
|
|
||||||
path = ""
|
|
||||||
opt = []
|
|
||||||
|
|
||||||
from bt.message import write
|
|
||||||
from tools import database
|
|
||||||
import settings
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
|
||||||
def open():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
return "Lists all available libraries"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(args=None):
|
|
||||||
cur = str(settings.get("curlib"))
|
|
||||||
result = database.select("name","library","id="+str(cur)).fetchone()[0]
|
|
||||||
|
|
||||||
write("Current Library: "+result)
|
|
||||||
|
|
||||||
result = database.select("*","library").fetchall()
|
|
||||||
if len(result) == 0:
|
|
||||||
return
|
|
||||||
|
|
||||||
write("Name\tPath")
|
|
||||||
write("------------")
|
|
||||||
|
|
||||||
for lib in result:
|
|
||||||
write(lib[1]+"\t"+lib[2])
|
|
||||||
return result
|
|
|
@ -1,75 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Jan 2, 2010 1:18:37 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
global name, app, type, path, opt
|
|
||||||
name = "next"
|
|
||||||
app = "ocarina"
|
|
||||||
type = "core"
|
|
||||||
path = ""
|
|
||||||
opt = []
|
|
||||||
|
|
||||||
from bt.message import write
|
|
||||||
from bt.file import join
|
|
||||||
import settings
|
|
||||||
from tools import database
|
|
||||||
from manager import manager
|
|
||||||
|
|
||||||
|
|
||||||
def next():
|
|
||||||
cur = str(settings.get("curlib"))
|
|
||||||
count = database.select("count(*)","libtrack","library="+cur).fetchone()[0]
|
|
||||||
|
|
||||||
curtrk = settings.get("current")
|
|
||||||
if curtrk > count:
|
|
||||||
curtrk = 0
|
|
||||||
else:
|
|
||||||
curtrk += 1
|
|
||||||
rows = database.select("track","libtrack","library="+cur).fetchall()
|
|
||||||
return rows[curtrk][0],curtrk
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
|
||||||
def open():
|
|
||||||
if settings.has("current") == False:
|
|
||||||
settings.set("current",0)
|
|
||||||
settings.init("next",next)
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
settings.delete("next")
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
return "Advances to the next song"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(args=None):
|
|
||||||
if settings.has("curlib") == False:
|
|
||||||
return
|
|
||||||
curlib = str(settings.get("curlib"))
|
|
||||||
id,curtrk = settings.get("next")()
|
|
||||||
|
|
||||||
database.open()
|
|
||||||
a = database.select("path","library","id="+curlib).fetchone()[0]
|
|
||||||
b = database.select("path","track","id="+str(id)).fetchone()[0]
|
|
||||||
|
|
||||||
info = database.select("track.name, artist.name, album.name",
|
|
||||||
"track, album, artist",
|
|
||||||
"track.id="+str(id)+" and track.artist=artist.id and track.album=album.id").fetchone()
|
|
||||||
|
|
||||||
database.close()
|
|
||||||
settings.set("current",curtrk)
|
|
||||||
manager.run("load",([a+b]))
|
|
||||||
|
|
||||||
write(info[0])
|
|
||||||
write("By: "+info[1])
|
|
||||||
write("From: "+info[2])
|
|
||||||
|
|
||||||
manager.run("play")
|
|
|
@ -1,49 +1,28 @@
|
||||||
#! /usr/bin/python
|
# Basic plugin class
|
||||||
|
|
||||||
# To change this template, choose Tools | Templates
|
|
||||||
# and open the template in the editor.
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
__author__="bjschuma"
|
||||||
__date__ ="$Dec 21, 2009 9:18:52 PM$"
|
__date__ ="$Jan 25, 2010 12:18:21 AM$"
|
||||||
|
|
||||||
|
|
||||||
global name, app, type, path, opt
|
from bt import plugin
|
||||||
name = "ocarina"
|
|
||||||
app = "ocarina"
|
|
||||||
type = "core"
|
|
||||||
path = ""
|
|
||||||
opt = []
|
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
from bt.message import write
|
settings.set("appname","ocarina2")
|
||||||
from bt.file import *
|
|
||||||
import bt.proc
|
|
||||||
from manager import manager
|
|
||||||
from tools import database
|
|
||||||
from tools import gstreamer
|
|
||||||
|
|
||||||
|
|
||||||
settings.set("user", join(settings.get("user"),".ocarina2"))
|
class Plugin(plugin.Plugin):
|
||||||
mkdir(settings.get("user"))
|
def __init__(self):
|
||||||
settings.set("appname","ocarina")
|
plugin.Plugin.__init__(self)
|
||||||
|
self.help = ""
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
def open(self):
|
||||||
def open():
|
|
||||||
write("Ocarina has been started",True)
|
|
||||||
database.init()
|
|
||||||
gstreamer.init()
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
write("Ocarina has been stopped",True)
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
return "A simple music player"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(args=None):
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def run(self, args=None):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Dec 22, 2009 12:29:58 AM$"
|
|
||||||
|
|
||||||
|
|
||||||
global name, app, type, path, opt
|
|
||||||
name = "pause"
|
|
||||||
app = "ocarina"
|
|
||||||
type = "core"
|
|
||||||
path = ""
|
|
||||||
opt = []
|
|
||||||
|
|
||||||
from tools import gstreamer
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
|
||||||
def open():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
return "Pauses playback"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(args=None):
|
|
||||||
gstreamer.pause()
|
|
|
@ -1,34 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Dec 22, 2009 12:05:02 AM$"
|
|
||||||
|
|
||||||
|
|
||||||
global name, app, type, path, opt
|
|
||||||
name = "play"
|
|
||||||
app = "ocarina"
|
|
||||||
type = "core"
|
|
||||||
path = ""
|
|
||||||
opt = []
|
|
||||||
|
|
||||||
from bt.message import write
|
|
||||||
from tools import gstreamer
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
|
||||||
def open():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
return "Begins playback"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(args=None):
|
|
||||||
gstreamer.play()
|
|
|
@ -1,77 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Dec 27, 2009 8:07:18 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
global name, app, type, path, opt
|
|
||||||
name = "scan"
|
|
||||||
app = "ocarina"
|
|
||||||
type = "core"
|
|
||||||
path = ""
|
|
||||||
opt = []
|
|
||||||
|
|
||||||
import tagpy
|
|
||||||
|
|
||||||
from bt.message import write
|
|
||||||
from bt.file import *
|
|
||||||
|
|
||||||
import settings
|
|
||||||
from manager import manager
|
|
||||||
#from library import *
|
|
||||||
from tools import database
|
|
||||||
from tools import extract
|
|
||||||
#from library.scan import scan
|
|
||||||
|
|
||||||
global root
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
|
||||||
def open():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
return "Scans over a directory and attempts to add the music files"
|
|
||||||
|
|
||||||
# Performs the actual scanning
|
|
||||||
def scan(dir):
|
|
||||||
files = ls(dir)
|
|
||||||
for file in files:
|
|
||||||
path = join(dir,file)
|
|
||||||
if checkDir(path)==True:
|
|
||||||
scan(path)
|
|
||||||
else:
|
|
||||||
write(path,True)
|
|
||||||
global root
|
|
||||||
#manager.run("extract", (root,path))
|
|
||||||
extract.run((root,path))
|
|
||||||
#database.insert(path)
|
|
||||||
#self.files += [path]
|
|
||||||
|
|
||||||
|
|
||||||
# Called to scan a directory. Performs initial path expansion before traversing
|
|
||||||
def run(args=None):
|
|
||||||
if args == None:
|
|
||||||
return
|
|
||||||
space = ' '
|
|
||||||
global root
|
|
||||||
root = expandPath( space.join(args) )
|
|
||||||
|
|
||||||
database.open()
|
|
||||||
scan(root)
|
|
||||||
|
|
||||||
#count = str(database.count("files"))
|
|
||||||
count = str(database.count("artist"))
|
|
||||||
write("Library contains "+count+" artists.")
|
|
||||||
count = str(database.count("album"))
|
|
||||||
write("Library contains "+count+" albums.")
|
|
||||||
count = str(database.count("track"))
|
|
||||||
write("Library contains "+count+" tracks.")
|
|
||||||
|
|
||||||
database.close()
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Jan 5, 2010 4:15:12 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
global name, app, type, path, opt
|
|
||||||
name = "switchlib"
|
|
||||||
app = "ocarina"
|
|
||||||
type = "core"
|
|
||||||
path = ""
|
|
||||||
opt = []
|
|
||||||
|
|
||||||
from bt.message import write
|
|
||||||
from tools import database
|
|
||||||
import settings
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
|
||||||
def open():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
return "Switches between multiple libraries"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(args=None):
|
|
||||||
if args == 0:
|
|
||||||
return
|
|
||||||
|
|
||||||
name = args[0]
|
|
||||||
write("Switching to: "+name)
|
|
||||||
|
|
||||||
result = database.select("id","library","name=\'"+name+"\'").fetchone()[0]
|
|
||||||
settings.replace("curlib",int(result))
|
|
|
@ -1,4 +0,0 @@
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Dec 28, 2009 12:21:59 AM$"
|
|
||||||
|
|
||||||
__all__ = ['database', 'extract']
|
|
|
@ -1,139 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Dec 27, 2009 9:58:50 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
import settings
|
|
||||||
from bt.file import *
|
|
||||||
|
|
||||||
import sqlite3
|
|
||||||
|
|
||||||
global db
|
|
||||||
global conn
|
|
||||||
global vals
|
|
||||||
db = None
|
|
||||||
conn = None
|
|
||||||
vals = dict()
|
|
||||||
|
|
||||||
|
|
||||||
# Collect all information for what to insert
|
|
||||||
# Build into a large statement, then insert
|
|
||||||
# This will speed things up
|
|
||||||
# Reconnect to sqlite at every run, to avoid thread problems
|
|
||||||
|
|
||||||
|
|
||||||
def create():
|
|
||||||
global conn
|
|
||||||
conn.executescript("""
|
|
||||||
CREATE TABLE files
|
|
||||||
(
|
|
||||||
path TEXT PRIMARY KEY
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE artist
|
|
||||||
(
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
name TEXT UNIQUE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE album
|
|
||||||
(
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
name TEXT UNIQUE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE library
|
|
||||||
(
|
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
name TEXT UNIQUE,
|
|
||||||
path TEXT UNIQUE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE track
|
|
||||||
(
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
artist INTEGER,
|
|
||||||
album INTEGER,
|
|
||||||
count INTEGER,
|
|
||||||
length INTEGER,
|
|
||||||
name TEXT,
|
|
||||||
path TEXT UNIQUE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE libtrack
|
|
||||||
(
|
|
||||||
library INTEGER,
|
|
||||||
track INTEGER
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
""")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def open():
|
|
||||||
global db, conn
|
|
||||||
conn = sqlite3.connect(db)
|
|
||||||
conn.text_factory = str
|
|
||||||
|
|
||||||
|
|
||||||
def close():
|
|
||||||
global conn
|
|
||||||
conn.commit()
|
|
||||||
conn.close()
|
|
||||||
conn = None
|
|
||||||
|
|
||||||
|
|
||||||
def commit():
|
|
||||||
global conn
|
|
||||||
if conn == None:
|
|
||||||
return
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
global db, vals
|
|
||||||
db = join(settings.get("user"),"ocarina.db")
|
|
||||||
dbExists = checkPath(db)
|
|
||||||
open()
|
|
||||||
# Create database if it doesn't exist yet
|
|
||||||
if dbExists == False:
|
|
||||||
create()
|
|
||||||
# Fill out information for all values
|
|
||||||
vals["files"] = "?"
|
|
||||||
vals["artist"]= "?,?"
|
|
||||||
vals["album"] = "?,?"
|
|
||||||
vals["library"] = "?,?,?"
|
|
||||||
vals["track"] = "?,?,?,?,?,?,?"
|
|
||||||
vals["libtrack"] = "?,?"
|
|
||||||
close()
|
|
||||||
|
|
||||||
|
|
||||||
def execute(statement, values=None):
|
|
||||||
global conn
|
|
||||||
if conn == None:
|
|
||||||
open()
|
|
||||||
|
|
||||||
if values == None:
|
|
||||||
return conn.execute(statement)
|
|
||||||
else:
|
|
||||||
return conn.execute(statement,values)
|
|
||||||
|
|
||||||
|
|
||||||
def insert(table, values):
|
|
||||||
global vals
|
|
||||||
execute('INSERT OR IGNORE INTO ' + table + ' VALUES(' + vals[table] + ')',values)
|
|
||||||
|
|
||||||
|
|
||||||
def count(table):
|
|
||||||
return execute('select count(*) from ' + table).fetchone()[0]
|
|
||||||
|
|
||||||
|
|
||||||
def select(select,table,where=None):
|
|
||||||
statement = 'select '+select+' from '+table
|
|
||||||
if not (where==None):
|
|
||||||
statement += ' where '+where
|
|
||||||
#print statement
|
|
||||||
result = execute(statement)
|
|
||||||
return result
|
|
|
@ -1,111 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Dec 28, 2009 10:21:06 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
from bt.message import write
|
|
||||||
from tools import database
|
|
||||||
import settings
|
|
||||||
|
|
||||||
import re
|
|
||||||
import tagpy
|
|
||||||
|
|
||||||
global goodFiles
|
|
||||||
goodFiles = ["mp3", "ogg"]
|
|
||||||
|
|
||||||
global search
|
|
||||||
|
|
||||||
|
|
||||||
# Generate the search string
|
|
||||||
def genSearch():
|
|
||||||
global goodFiles
|
|
||||||
global search
|
|
||||||
search = ".*\.("
|
|
||||||
for index,file in enumerate(goodFiles):
|
|
||||||
if index > 0:
|
|
||||||
search += "|"
|
|
||||||
search += file
|
|
||||||
search += ")"
|
|
||||||
|
|
||||||
genSearch()
|
|
||||||
|
|
||||||
|
|
||||||
# Return true if the file is valid and false if it is not
|
|
||||||
def validFile(filename):
|
|
||||||
global search
|
|
||||||
match = re.search(search,filename,re.IGNORECASE)
|
|
||||||
if match==None:
|
|
||||||
write(filename)
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def findId(table,name):
|
|
||||||
result = database.select("id",table,"name=\'"+name.replace("\'","\'\'")+"\'").fetchone()
|
|
||||||
if result == None:
|
|
||||||
return database.count(table),False
|
|
||||||
return result[0],True
|
|
||||||
|
|
||||||
|
|
||||||
def insLibTrk(trid):
|
|
||||||
libid = settings.get("curlib")
|
|
||||||
lib = str(libid)
|
|
||||||
trk = str(trid)
|
|
||||||
result = database.select("*","libtrack","track="+trk+" and library="+lib).fetchone()
|
|
||||||
if result == None:
|
|
||||||
return True,libid
|
|
||||||
return False,-1
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(file=None):
|
|
||||||
if file == None:
|
|
||||||
return
|
|
||||||
|
|
||||||
if len(file) < 2:
|
|
||||||
return
|
|
||||||
|
|
||||||
root = file[0]
|
|
||||||
file = file[1]
|
|
||||||
|
|
||||||
if validFile(file) == False:
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
f = tagpy.FileRef(file)
|
|
||||||
t = f.tag()
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Find artist information
|
|
||||||
artist = t.artist
|
|
||||||
if artist == "":
|
|
||||||
artist = "Unknown Artist"
|
|
||||||
# Insert the artist of it is new
|
|
||||||
arid,inserted = findId("artist",artist)
|
|
||||||
if inserted == False:
|
|
||||||
database.insert("artist", (arid, artist) )
|
|
||||||
|
|
||||||
# Find album information
|
|
||||||
album = t.album
|
|
||||||
if album == "":
|
|
||||||
album = "Unknown Album"
|
|
||||||
# Insert the album if it is new
|
|
||||||
alid,inserted = findId("album",album)
|
|
||||||
if inserted == False:
|
|
||||||
database.insert("album", (alid, album) )
|
|
||||||
|
|
||||||
# Find the track information
|
|
||||||
title = t.title
|
|
||||||
if title == "":
|
|
||||||
title = "Unknown Title"
|
|
||||||
# Insert the track if it is new
|
|
||||||
trid,inserted = findId("track",title)
|
|
||||||
if inserted == False:
|
|
||||||
a = f.audioProperties()
|
|
||||||
database.insert("track", (trid,arid,alid,0,a.length,title,file[len(root):]))
|
|
||||||
|
|
||||||
ins,libid = insLibTrk(trid)
|
|
||||||
if ins == True:
|
|
||||||
database.insert("libtrack", (libid,trid))
|
|
|
@ -1,104 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Dec 21, 2009 11:58:37 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
from bt.file import *
|
|
||||||
import gst
|
|
||||||
|
|
||||||
import settings
|
|
||||||
from manager import manager
|
|
||||||
from cline import message
|
|
||||||
global pipeline
|
|
||||||
pipeline = None
|
|
||||||
|
|
||||||
global time
|
|
||||||
time = gst.Format(gst.FORMAT_TIME)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def load(filename):
|
|
||||||
filename = expandPath(filename)
|
|
||||||
if checkPath(filename) == False:
|
|
||||||
return
|
|
||||||
|
|
||||||
write("loading file: "+filename,True)
|
|
||||||
bin = gst.element_factory_make("playbin", None)
|
|
||||||
bin.set_property("uri", "file://"+filename)
|
|
||||||
bin.set_state(gst.STATE_PAUSED)
|
|
||||||
|
|
||||||
global pipeline
|
|
||||||
pipeline = gst.Pipeline("player")
|
|
||||||
pipeline.add(bin)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def play():
|
|
||||||
global pipeline
|
|
||||||
pipeline.set_state(gst.STATE_PLAYING)
|
|
||||||
|
|
||||||
|
|
||||||
def pause():
|
|
||||||
global pipeline
|
|
||||||
pipeline.set_state(gst.STATE_PAUSED)
|
|
||||||
|
|
||||||
|
|
||||||
def progress():
|
|
||||||
global pipeline
|
|
||||||
global time
|
|
||||||
|
|
||||||
# Don't bother to go on if the pipeline isn't playing
|
|
||||||
if not pipeline.get_state()[1] == gst.STATE_PLAYING:
|
|
||||||
return -1
|
|
||||||
|
|
||||||
position = pipeline.query_position(time)[0]
|
|
||||||
total = pipeline.query_duration(time)[0]
|
|
||||||
return float(position) / float(total)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# If the song is done, play the next song
|
|
||||||
def done():
|
|
||||||
p = progress()
|
|
||||||
|
|
||||||
if p == -1:
|
|
||||||
return
|
|
||||||
|
|
||||||
max = int(settings.get("maxyx")[1] * p)
|
|
||||||
bar = "="
|
|
||||||
message.disp(bar*max, settings.get("maxyx")[0]-1)
|
|
||||||
|
|
||||||
|
|
||||||
if p == 1.0:
|
|
||||||
#if position == total:
|
|
||||||
manager.run("next")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
|
||||||
def init():
|
|
||||||
global pipeline
|
|
||||||
pipeline = gst.Pipeline()
|
|
||||||
pipeline.set_state(gst.STATE_NULL)
|
|
||||||
songs = settings.get("args")
|
|
||||||
|
|
||||||
settings.set("everyloop",done)
|
|
||||||
|
|
||||||
if len(songs) > 0:
|
|
||||||
load(songs[0])
|
|
||||||
settings.replace("args", [])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
|
||||||
def close():
|
|
||||||
global pipeline
|
|
||||||
pipeline.set_state(gst.STATE_NULL)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the plugin needs to perform some action
|
|
||||||
def run(args=None):
|
|
||||||
pass
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CORE=`pwd`/`dirname $0`"/core"
|
CORE=`pwd`/`dirname $0`"/core"
|
||||||
EXTRA=`pwd`/`dirname $0`"/extra"
|
#EXTRA=`pwd`/`dirname $0`"/extra"
|
||||||
cd && `which scion` "-p $CORE -p $EXTRA" $*
|
cd && `which scion` "-p $CORE" $*
|
||||||
|
|
12
src/release
12
src/release
|
@ -1,13 +1,21 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DIR=ocarina.`date +%F`
|
DIR=ocarina-1.0
|
||||||
SCION=/opt/scion/
|
SCION=/opt/scion/
|
||||||
|
|
||||||
sh ./clean
|
#sh ./clean
|
||||||
mkdir $DIR
|
mkdir $DIR
|
||||||
cp -r core $DIR
|
cp -r core $DIR
|
||||||
cp -r extra $DIR
|
cp -r extra $DIR
|
||||||
cp -r $SCION/base $DIR
|
cp -r $SCION/base $DIR
|
||||||
cp -r $SCION/core $DIR
|
cp -r $SCION/core $DIR
|
||||||
cp -r $SCION/extra $DIR
|
cp -r $SCION/extra $DIR
|
||||||
|
cp ocarina clean.sh $DIR
|
||||||
|
|
||||||
|
cd $DIR
|
||||||
|
sh ./clean.sh
|
||||||
|
rm clean.sh
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
tar -cvf $DIR.tar.gz $DIR
|
||||||
|
rm -r $DIR
|
||||||
|
|
Loading…
Reference in New Issue
Block a user