当前位置: 首页>>代码示例>>Python>>正文


Python Organizer.quote方法代码示例

本文整理汇总了Python中Core.Organizer.quote方法的典型用法代码示例。如果您正苦于以下问题:Python Organizer.quote方法的具体用法?Python Organizer.quote怎么用?Python Organizer.quote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core.Organizer的用法示例。


在下文中一共展示了Organizer.quote方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: changeFilePath

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import quote [as 别名]
def changeFilePath(_oldPath, _newPath):
    _oldPath, _newPath = str(_oldPath), str(_newPath)
    withOutDevicePointValues, withOutDeviceValues = [], []
    for devicePoint in getDevices():
        if devicePoint[1] + "/" == _oldPath[:len(devicePoint[1]) + 1]:
            if devicePoint[1] + "/" == _newPath[:len(devicePoint[1]) + 1]:
                withOutDevicePointValues.append({"id": devicePoint[0],
                                                 "oldPath": Databases.correctForSql(_oldPath[len(devicePoint[1]):]),
                                                 "newPath": Databases.correctForSql(_newPath[len(devicePoint[1]):])
                })
            else:
                withOutDeviceValues.append({"id": devicePoint[0],
                                            "oldPath": Databases.correctForSql(_oldPath[len(devicePoint[1]):]),
                                            "newPath": Databases.correctForSql(_newPath)
                })
    _oldPath, _newPath = Databases.correctForSql(_oldPath), Databases.correctForSql(_newPath)
    _oldPathUrl, _newPathUrl = Databases.correctForSql(Organizer.quote(_oldPath)), Databases.correctForSql(Organizer.quote(_newPath))
    db = Amarok.checkAndGetDB()
    db.query("UPDATE urls SET rpath='.%s' WHERE rpath='.%s'" % (_newPath, _oldPath))
    for withOutDevice in withOutDeviceValues:
        directoryID = getOrInsertDirectory(fu.getDirName(withOutDevice["newPath"]), "-1")
        db.query("UPDATE urls SET rpath='.%s', directory=%s, deviceid = -1 WHERE deviceid = %s and rpath = '.%s' " % (
            withOutDevice["newPath"], directoryID, withOutDevice["id"], withOutDevice["oldPath"]))
    for withOutDevicePoint in withOutDevicePointValues:
        directoryID = getOrInsertDirectory(fu.getDirName(withOutDevicePoint["newPath"]), withOutDevicePoint["id"])
        db.query("UPDATE urls SET rpath='.%s', directory=%s WHERE deviceid = %s and rpath = '.%s'" % (
            withOutDevicePoint["newPath"], directoryID, withOutDevicePoint["id"], withOutDevicePoint["oldPath"]))
    db.query("UPDATE images SET path='%s' WHERE path='%s'" % (_newPath, _oldPath))
    db.query("UPDATE lyrics SET url='.%s' WHERE url='.%s'" % (_newPath, _oldPath))
    db.query("UPDATE statistics_permanent SET url='file://%s' WHERE url='file://%s'" % (_newPathUrl, _oldPathUrl))
    db.commit()
    return True
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:34,代码来源:Commands.py

示例2: changeDirectoryPath

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import quote [as 别名]
def changeDirectoryPath(_oldPath, _newPath):
    _oldPath, _newPath = str(_oldPath), str(_newPath)
    withOutDevicePointValues, withOutDeviceValues = [], []
    for devicePoint in getDevices():
        if devicePoint[1] + "/" == _oldPath[:len(devicePoint[1]) + 1]:
            if devicePoint[1] + "/" == _newPath[:len(devicePoint[1]) + 1]:
                withOutDevicePointValues.append({"id": devicePoint[0],
                                                 "oldPath": Databases.correctForSql(_oldPath[len(devicePoint[1]):]),
                                                 "newPath": Databases.correctForSql(_newPath[len(devicePoint[1]):])
                })
            else:
                withOutDeviceValues.append({"id": devicePoint[0],
                                            "oldPath": Databases.correctForSql(_oldPath[len(devicePoint[1]):]),
                                            "newPath": Databases.correctForSql(_newPath)
                })
    _oldPath, _newPath = Databases.correctForSql(_oldPath), Databases.correctForSql(_newPath)
    _oldPathUrl, _newPathUrl = Databases.correctForSql(Organizer.quote(_oldPath)), Databases.correctForSql(Organizer.quote(_newPath))
    db = Amarok.checkAndGetDB()
    db.query("UPDATE directories SET dir=REPLACE(dir, '.%s/', '.%s/')" % (_oldPath, _newPath))
    db.query("UPDATE urls SET rpath=REPLACE(rpath, '.%s/', '.%s/')" % (_oldPath, _newPath))
    for withOutDevice in withOutDeviceValues:
        db.query("UPDATE directories SET dir=REPLACE(dir, '.%s/', '.%s/'), deviceid = -1 WHERE deviceid = %s " % (
            withOutDevice["oldPath"], withOutDevice["newPath"], withOutDevice["id"]))
        db.query("UPDATE urls SET rpath=REPLACE(rpath, '.%s/', '.%s/'), deviceid = -1 WHERE deviceid = %s " % (
            withOutDevice["oldPath"], withOutDevice["newPath"], withOutDevice["id"]))
    for withOutDevicePoint in withOutDevicePointValues:
        db.query("UPDATE directories SET dir=REPLACE(dir, '.%s/', '.%s/') WHERE deviceid = %s " % (
            withOutDevicePoint["oldPath"], withOutDevicePoint["newPath"], withOutDevicePoint["id"]))
        db.query("UPDATE urls SET rpath=REPLACE(rpath, '.%s/', '.%s/') WHERE deviceid = %s " % (
            withOutDevicePoint["oldPath"], withOutDevicePoint["newPath"], withOutDevicePoint["id"]))
    db.query("UPDATE images SET path=REPLACE(path, '%s/', '%s/')" % (_oldPath, _newPath))
    db.query("UPDATE statistics_permanent SET url=REPLACE(url, '%s/', '%s/')" % (_oldPathUrl, _newPathUrl))
    db.commit()
    return True
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:36,代码来源:Commands.py

示例3: sendAndClose

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import quote [as 别名]
 def sendAndClose(self):
     try:
         uni.isCanBeShowOnMainWindow = False
         self.namMain = MNetworkAccessManager(self)
         self.connect(self.namMain, SIGNAL("finished (QNetworkReply *)"), self.sendFinished)
         self.nrqPost = MNetworkRequest(MUrl("http://hamsiapps.com/ForMyProjects/SuggestIdea.php"))
         self.nrpBack = self.namMain.post(self.nrqPost,
                                          "p=HamsiManager&l=" + str(uni.MySettings["language"]) + "&v=" + str(
                                              uni.intversion) +
                                          "&thankYouMessages=new style" +
                                          "&userNotes=" + Organizer.quote(str(self.teIdea.toHtml())) +
                                          "&nameAndSurname=" + Organizer.quote(str(self.leName.text())) +
                                          "&mail=" + Organizer.quote(str(self.leEMailAddress.text()))
         )
         self.connect(self.nrpBack, SIGNAL("downloadProgress (qint64,qint64)"), self.sending)
         Dialogs.showState(translate("SuggestIdea", "Sending Your Idea"), 0, 100, True, self.cancelSending)
     except:
         ReportBug.ReportBug()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:20,代码来源:SuggestIdea.py


注:本文中的Core.Organizer.quote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。