本文整理汇总了Python中Core.Universals.printForDevelopers方法的典型用法代码示例。如果您正苦于以下问题:Python Universals.printForDevelopers方法的具体用法?Python Universals.printForDevelopers怎么用?Python Universals.printForDevelopers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core.Universals
的用法示例。
在下文中一共展示了Universals.printForDevelopers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getDevices
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getDevices():
db = Amarok.checkAndGetDB()
query = "SELECT id,lastmountpoint FROM devices"
uni.printForDevelopers("Query - getDevices : " + query)
db.query(query)
r = db.store_result()
return r.fetch_row(0)
示例2: deleteAlbum
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def deleteAlbum(_albumId):
db = Amarok.checkAndGetDB()
queryUpdate = "DELETE FROM albums WHERE id=%s" % (_albumId)
uni.printForDevelopers("Query - deleteAlbum : " + queryUpdate)
db.query(queryUpdate)
db.commit()
return True
示例3: getAllArtistsValues
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getAllArtistsValues(_filter=""):
db = Amarok.checkAndGetDB()
_filter = str(_filter).strip()
query = """
SELECT DISTINCT
artists.id,
artists.name
FROM tracks
INNER JOIN urls ON urls.id = tracks.url
LEFT JOIN devices ON devices.id = urls.deviceid
LEFT JOIN artists ON artists.id = tracks.artist
LEFT JOIN albums ON albums.id = tracks.album
LEFT JOIN artists albumartists ON albumartists.id = albums.artist
LEFT JOIN years ON years.id = tracks.year
LEFT JOIN genres ON genres.id = tracks.genre
LEFT JOIN images ON images.id = albums.image
LEFT JOIN statistics ON statistics.url = tracks.url
LEFT JOIN lyrics ON lyrics.url = urls.id
"""
query += getSQLConditionByFilter(_filter, True) + " ORDER BY artists.name "
uni.printForDevelopers("Query - getAllArtistsValues : " + query)
db.query(query)
r = db.store_result()
musicFileValues = []
rows = r.fetch_row(0)
for row in rows:
musicFileValues.append({})
musicFileValues[-1]["id"] = row[0]
musicFileValues[-1]["name"] = row[1]
return musicFileValues
示例4: changeArtistWithAnother
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def changeArtistWithAnother(_currentArtistId, _artistWillBeSelectedId):
db = Amarok.checkAndGetDB()
queryUpdate1 = "UPDATE tracks SET artist=%s WHERE artist=%s" % (_artistWillBeSelectedId, _currentArtistId)
uni.printForDevelopers("Query - changeArtistWithAnother - queryUpdate1 : " + queryUpdate1)
db.query(queryUpdate1)
db.commit()
try:
db = Amarok.checkAndGetDB()
queryUpdate2 = "UPDATE albums SET artist=%s WHERE artist=%s" % (_artistWillBeSelectedId, _currentArtistId)
uni.printForDevelopers("Query - changeArtistWithAnother - queryUpdate2 : " + queryUpdate2)
db.query(queryUpdate2)
db.commit()
except Amarok.getMySQLModule().IntegrityError as error:
db = Amarok.checkAndGetDB()
db.query("SELECT * FROM albums WHERE name IN (SELECT name FROM albums WHERE artist=%s) AND artist=%s" % (
_artistWillBeSelectedId, _currentArtistId))
r = db.store_result()
rows = r.fetch_row(0)
for row in rows:
currentAlbumId = row[0]
currentAlbumName = row[1]
db = Amarok.checkAndGetDB()
db.query("SELECT * FROM albums WHERE name='%s' AND artist=%s" % (currentAlbumName, _artistWillBeSelectedId))
r = db.store_result()
srows = r.fetch_row(0)
if len(srows) > 0:
albumWillBeSelectedId = srows[0][0]
changeAlbumWithAnother(currentAlbumId, albumWillBeSelectedId)
deleteAlbum(currentAlbumId)
return True
示例5: getAllMusicFilePathsByAlbumArtistId
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getAllMusicFilePathsByAlbumArtistId(_artistId):
db = Amarok.checkAndGetDB()
query = """
SELECT
REPLACE(
CONCAT(
CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
SUBSTRING( urls.rpath , 2 )),
CONCAT('/',
CONCAT( CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
SUBSTRING( urls.rpath , 2 )))
, '') AS 'filePath'
FROM tracks
INNER JOIN urls ON urls.id = tracks.url
LEFT JOIN devices ON devices.id = urls.deviceid
LEFT JOIN albums ON albums.id = tracks.album
LEFT JOIN artists albumartists ON albumartists.id = albums.artist
WHERE albums.artist=""" + str(_artistId) + " ORDER BY filePath "
uni.printForDevelopers("Query - getAllMusicFilePathsByArtistId : " + query)
db.query(query)
r = db.store_result()
musicFileValues = []
rows = r.fetch_row(0)
for row in rows:
musicFileValues.append(row[0])
return musicFileValues
示例6: getOrInsertGenre
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getOrInsertGenre(_genre):
db = Amarok.checkAndGetDB()
for sqlCommand in Databases.getAmendedSQLSelectOrInsertAndSelectQueries("genres", "id", {
"name": "'" + Databases.correctForSql(_genre) + "'"}):
uni.printForDevelopers("Query - getOrInsertGenre : " + sqlCommand)
db.query(sqlCommand)
r = db.store_result()
return str(r.fetch_row(0)[0][0])
示例7: getOrInsertAlbum
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getOrInsertAlbum(_album, _artistId):
db = Amarok.checkAndGetDB()
for sqlCommand in Databases.getAmendedSQLSelectOrInsertAndSelectQueries("albums", "id", {
"name": "'" + Databases.correctForSql(_album) + "'", "artist": "'" + _artistId + "'"}):
uni.printForDevelopers("Query - getOrInsertAlbum : " + sqlCommand)
db.query(sqlCommand)
r = db.store_result()
return str(r.fetch_row(0)[0][0])
示例8: getArtistId
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getArtistId(_artist):
db = Amarok.checkAndGetDB()
query = "SELECT id FROM artists WHERE name='%s'" % (Databases.correctForSql(_artist))
uni.printForDevelopers("Query - getArtistId : " + query)
db.query(query)
r = db.store_result()
rows = r.fetch_row(0)
if len(rows) > 0:
return str(rows[0][0])
return None
示例9: getArtistName
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getArtistName(_artistId):
db = Amarok.checkAndGetDB()
query = "SELECT name FROM artists WHERE id=%s" % _artistId
uni.printForDevelopers("Query - getArtistName : " + query)
db.query(query)
r = db.store_result()
musicFileValues = []
rows = r.fetch_row(0)
if len(rows) > 0:
return str(rows[0][0])
return None
示例10: getAllMusicFileValuesWithNames
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getAllMusicFileValuesWithNames(_filter="", _artistId=None):
db = Amarok.checkAndGetDB()
query = """
SELECT tracks.id,
REPLACE(
CONCAT(CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
SUBSTRING( urls.rpath , 2 )),
CONCAT('/',
CONCAT(CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
SUBSTRING( urls.rpath , 2 )))
, '') AS 'filePath',
tracks.title,
tracks.artist AS 'artistId',
tracks.album AS 'albumId',
albums.artist AS 'albumArtistId',
tracks.year AS 'yearId',
tracks.genre AS 'genreId',
tracks.tracknumber AS 'trackNumber',
tracks.comment AS 'comment',
artists.name AS 'artist',
albums.name AS 'album',
albumartists.name AS 'albumArtist',
years.name AS 'year',
genres.name AS 'genre',
images.path AS 'imagePath',
statistics.rating,
lyrics.lyrics
FROM tracks
INNER JOIN urls ON urls.id = tracks.url
LEFT JOIN devices ON devices.id = urls.deviceid
LEFT JOIN artists ON artists.id = tracks.artist
LEFT JOIN albums ON albums.id = tracks.album
LEFT JOIN artists albumartists ON albumartists.id = albums.artist
LEFT JOIN years ON years.id = tracks.year
LEFT JOIN genres ON genres.id = tracks.genre
LEFT JOIN images ON images.id = albums.image
LEFT JOIN statistics ON statistics.url = tracks.url
LEFT JOIN lyrics ON lyrics.url = urls.id
"""
isAddWhere = True
if _artistId:
query += " WHERE (tracks.artist=" + str(_artistId) + " OR albums.artist=" + str(_artistId) + ") "
isAddWhere = False
query += getSQLConditionByFilter(_filter, isAddWhere) + " ORDER BY filePath "
uni.printForDevelopers("Query - getAllMusicFileValuesWithNames : " + query)
c = db.cursor(Amarok.getCursors().DictCursor)
c.execute(query)
musicFileValues = []
for rows in c.fetchall():
musicFileValues.append({})
for key in rows.keys():
musicFileValues[-1][key] = Databases.correctForUser(rows[key])
return musicFileValues
示例11: getDirectoriesAndValues
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getDirectoriesAndValues(_filter=""):
db = Amarok.checkAndGetDB()
query = """
SELECT DISTINCT
REPLACE(
CONCAT(CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
SUBSTRING(urls.rpath , 2)),
CONCAT('/',
SUBSTRING_INDEX(
CONCAT(CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
SUBSTRING(urls.rpath , 2)),
'/' , -1))
, '') AS 'dirPath',
images.path AS 'imagePath',
artists.name AS 'artistName',
albums.name AS 'albumName',
years.name AS 'yearName',
genres.name AS 'genreName'
FROM tracks
LEFT JOIN urls ON urls.id = tracks.url
LEFT JOIN devices ON devices.id = urls.deviceid
LEFT JOIN artists ON artists.id = tracks.artist
LEFT JOIN albums ON albums.id = tracks.album
LEFT JOIN years ON years.id = tracks.year
LEFT JOIN genres ON genres.id = tracks.genre
LEFT JOIN images ON images.id = albums.image
LEFT JOIN artists albumartists ON albumartists.id = albums.artist
LEFT JOIN statistics ON statistics.url = tracks.url
WHERE images.path IS NOT NULL AND images.path NOT LIKE 'amarok-sqltrackuid:%'
"""
query += getSQLConditionByFilter(_filter, False) + " ORDER BY dirPath "
uni.printForDevelopers("Query - getDirectoriesAndValues : " + query)
db.query(query)
r = db.store_result()
directoriesValues = {}
rows = r.fetch_row(0)
for row in rows:
if row[0] not in directoriesValues:
directoriesValues[row[0]] = {"coverPath": [], "artist": [], "album": [], "year": [], "genre": []}
directoriesValues[row[0]]["coverPath"].append(row[1])
directoriesValues[row[0]]["artist"].append(row[2])
directoriesValues[row[0]]["album"].append(row[3])
directoriesValues[row[0]]["year"].append(row[4])
directoriesValues[row[0]]["genre"].append(row[5])
return directoriesValues
示例12: changeArtistValue
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def changeArtistValue(_values):
if len(_values) > 1:
db = Amarok.checkAndGetDB()
try:
queryUpdate = "UPDATE artists SET name='%s' WHERE id=%s" % (
Databases.correctForSql(_values["name"]), _values["id"])
uni.printForDevelopers("Query - changeArtistValue : " + queryUpdate)
db.query(queryUpdate)
db.commit()
return [_values["name"],
getAllMusicFilePathsByArtistId(_values["id"]),
getAllMusicFilePathsByAlbumArtistId(_values["id"])]
except Amarok.getMySQLModule().IntegrityError as error:
returnValues = [_values["name"],
getAllMusicFilePathsByArtistId(_values["id"]),
getAllMusicFilePathsByAlbumArtistId(_values["id"])]
changeArtistWithAnother(_values["id"], getArtistId(_values["name"]))
deleteArtist(_values["id"])
return returnValues
return None
示例13: getOrInsertDirectory
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def getOrInsertDirectory(_directory, _deviceId):
_deviceId = str(_deviceId)
if _directory[-1] != "/": _directory += "/"
if _directory[0] != ".": _directory = "." + _directory
db = Amarok.checkAndGetDB()
sqlSelectCommand = "SELECT id FROM directories WHERE deviceid=" + _deviceId + " AND dir='" + Databases.correctForSql(
_directory) + "'"
uni.printForDevelopers("Query - getOrInsertDirectory - sqlSelectCommand - 1 : " + sqlSelectCommand)
db.query(sqlSelectCommand)
r = db.store_result()
rows = r.fetch_row(0)
if len(rows) == 0:
sqlInsertCommand = "INSERT INTO directories(deviceid,dir) VALUES (" + _deviceId + ",'" + Databases.correctForSql(
_directory) + "')"
uni.printForDevelopers("Query - getOrInsertDirectory - sqlInsertCommand : " + sqlInsertCommand)
db.query(sqlInsertCommand)
uni.printForDevelopers("Query - getOrInsertDirectory - sqlSelectCommand - 2 : " + sqlSelectCommand)
db.query(sqlSelectCommand)
r = db.store_result()
rows = r.fetch_row(0)
return rows[0][0]
示例14: changeTag
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def changeTag(_values):
if len(_values) > 1:
path = _values["path"]
db = Amarok.checkAndGetDB()
querySelect = """
SELECT trackId,albumArtistId,urlId FROM (
SELECT tracks.id AS 'trackId',
REPLACE(
CONCAT(CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
SUBSTRING( urls.rpath , 2 )),
CONCAT('/',
CONCAT(CASE WHEN devices.lastmountpoint IS NOT NULL THEN devices.lastmountpoint ELSE '' END,
SUBSTRING( urls.rpath , 2 )))
, '') AS 'filePath',
albums.artist AS 'albumArtistId',
urls.id AS 'urlId'
FROM tracks
INNER JOIN urls ON urls.id = tracks.url
LEFT JOIN devices ON devices.id = urls.deviceid
LEFT JOIN albums ON albums.id = tracks.album
LEFT JOIN artists albumartists ON albumartists.id = albums.artist
) as valueTable WHERE filePath = '%s'
""" % Databases.correctForSql(path)
uni.printForDevelopers("Query - changeTag - querySelect : " + querySelect)
db.query(querySelect)
r = db.store_result()
rows = r.fetch_row(0)
if len(rows) == 0:
return None
trackId = str(rows[0][0])
albumArtistId = str(rows[0][1])
urlId = str(rows[0][2])
db = Amarok.checkAndGetDB()
query = " "
if "artist" in _values:
query += ", artist=" + getOrInsertArtist(_values["artist"])
if "albumArtist" in _values:
albumArtistId = getOrInsertArtist(_values["albumArtist"])
query += ", artist=" + albumArtistId
if "title" in _values:
query += ", title='" + Databases.correctForSql(_values["title"]) + "' "
if "album" in _values:
query += ", album=" + getOrInsertAlbum(_values["album"], albumArtistId)
if "trackNum" in _values:
query += ", tracknumber=" + Databases.correctForSql(_values["trackNum"], "int")
if "year" in _values:
query += ", year=" + getOrInsertYear(_values["year"])
if "genre" in _values:
query += ", genre=" + getOrInsertGenre(_values["genre"])
if "firstComment" in _values:
query += ", comment='" + Databases.correctForSql(_values["firstComment"]) + "' "
if "firstLyrics" in _values:
lyricQuery = ("INSERT INTO lyrics(url,lyrics) VALUES (" + urlId + ",'" + Databases.correctForSql(
_values["firstLyrics"]) + "') ON DUPLICATE KEY UPDATE lyrics=VALUES(lyrics) ")
uni.printForDevelopers("Query - changeTag - lyricQuery : " + lyricQuery)
db.query(lyricQuery)
if query.strip() != "":
query = query[2:] # for first ","
queryUpdate = "UPDATE tracks SET %s WHERE id=%s" % (query, trackId)
uni.printForDevelopers("Query - changeTag - queryUpdate : " + queryUpdate)
db.query(queryUpdate)
db.commit()
return True
示例15: __init__
# 需要导入模块: from Core import Universals [as 别名]
# 或者: from Core.Universals import printForDevelopers [as 别名]
def __init__(self):
MMainWindow.__init__(self, None)
uni.printForDevelopers("Started __init__")
self.setObjectName("RealMainWindow")
setMainWindow(self)
self.isLockedMainForm = False
self.Menu = None
self.Table = None
self.CentralWidget = MWidget()
self.createMainLayout()
uni.printForDevelopers("Before Bars.Bars")
uni.printForDevelopers("Before Bars.StatusBar")
self.StatusBar = StatusBar.StatusBar(self)
uni.printForDevelopers("Before Bars.MenuBar")
self.Menu = MenuBar.MenuBar(self)
uni.printForDevelopers("Before Bars.ToolsBar")
self.ToolsBar = ToolsBar.ToolsBar(self)
uni.printForDevelopers("Before Bars.TableToolsBar")
self.TableToolsBar = TableToolsBar.TableToolsBar(self)
uni.printForDevelopers("Before Bars.refreshBars")
Bars.refreshBars()
uni.printForDevelopers("Before FileManager.FileManager")
self.FileManager = FileManager.FileManager(self)
uni.printForDevelopers("After FileManager.FileManager")
self.setMainLayout()
self.setCentralWidget(self.CentralWidget)
self.setMenuBar(self.Menu)
self.setStatusBar(self.StatusBar)
uni.printForDevelopers("Before Menu.refreshForTableType")
self.Menu.refreshForTableType()
uni.printForDevelopers("Before Bars.getAllBarsStyleFromMySettings")
Bars.getAllBarsStyleFromMySettings()
self.setCorner(Mt.TopLeftCorner, Mt.LeftDockWidgetArea)
self.setCorner(Mt.BottomLeftCorner, Mt.LeftDockWidgetArea)
uni.printForDevelopers("End of __init__")