本文整理汇总了Python中maraschino.database.db_session.delete函数的典型用法代码示例。如果您正苦于以下问题:Python delete函数的具体用法?Python delete怎么用?Python delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: remove_module
def remove_module(name):
"""Remove module from the page"""
module = Module.query.filter(Module.name == name).first()
db_session.delete(module)
db_session.commit()
return jsonify({ 'status': 'success' })
开发者ID:wjbridge,项目名称:maraschino,代码行数:7,代码来源:modules.py
示例2: removeStaleServers
def removeStaleServers(current):
servers = PlexServer.query.order_by(PlexServer.id).all()
for server in servers:
if server.machineIdentifier not in current:
db_session.delete(server)
logger.log("Plex :: Removed %s from db as it is stale" % server, 'DEBUG')
db_session.commit()
开发者ID:RoostayFish,项目名称:maraschino,代码行数:8,代码来源:noneditable.py
示例3: delete_application
def delete_application(application_id):
try:
application = Application.query.filter(Application.id == application_id).first()
db_session.delete(application)
db_session.commit()
except:
return jsonify({ 'status': 'error' })
return xhr_applications()
开发者ID:BeegorMif,项目名称:maraschino,代码行数:10,代码来源:applications.py
示例4: delete_disk
def delete_disk(disk_id):
try:
disk = HardDisk.query.filter(HardDisk.id == disk_id).first()
db_session.delete(disk)
db_session.commit()
except:
return jsonify({'status': 'error'})
return xhr_diskspace()
开发者ID:wjbridge,项目名称:maraschino,代码行数:10,代码来源:diskspace.py
示例5: delete_newznab
def delete_newznab(newznab_id):
try:
newznab = NewznabSite.query.filter(NewznabSite.id == newznab_id).first()
db_session.delete(newznab)
db_session.commit()
except:
return jsonify(error=True)
return xhr_search()
开发者ID:stefaanlepever,项目名称:maraschino,代码行数:10,代码来源:search.py
示例6: delete_script
def delete_script(script_id):
try:
script = Script.query.filter(Script.id == script_id).first()
db_session.delete(script)
db_session.commit()
except:
logger.log('SCRIPT_LAUNCHER :: Delete Failed', 'ERROR')
return jsonify({ 'status': 'Delete Failed' })
return xhr_script_launcher()
开发者ID:DejaVu,项目名称:maraschino,代码行数:11,代码来源:script_launcher.py
示例7: delete_server
def delete_server(server_id=None):
"""
Deletes a server.
"""
try:
xbmc_server = XbmcServer.query.get(server_id)
db_session.delete(xbmc_server)
db_session.commit()
return render_template('includes/servers.html',
servers = XbmcServer.query.order_by(XbmcServer.position),
)
except:
logger.log('Error deleting server ID %s' % server_id , 'WARNING')
return jsonify({ 'status': 'error' })
开发者ID:ashfp,项目名称:maraschino,代码行数:17,代码来源:modules.py
示例8: plex_database_upgrade_check
def plex_database_upgrade_check():
logger.log('Starting database upgrade check.', 'INFO')
from maraschino.models import XbmcServer, MediaServer
from maraschino.database import db_session
# Check for any servers in the legacy 'XbmcServer' table. If found migrate over to the new tables
servers = XbmcServer.query.order_by(XbmcServer.position)
for server in servers:
# We have servers so migrate them
logger.log("The server named '" + server.label + "' is being upgraded!", 'INFO')
newServer = MediaServer(server.label, 'XBMC', {'hostname': server.hostname, 'port': server.port,
'username': server.username, 'password': server.password, 'mac_address': server.mac_address},
server.position)
db_session.add(newServer)
db_session.delete(server)
db_session.commit()
logger.log('Finished database upgrade check', 'INFO')
开发者ID:bob3695,项目名称:maraschino,代码行数:19,代码来源:__init__.py
示例9: delete_server
def delete_server(server_id=None):
"""
Deletes a server.
"""
try:
xbmc_server = XbmcServer.query.get(server_id)
db_session.delete(xbmc_server)
db_session.commit()
# Remove the server's cache
label = xbmc_server.label
recent_cache = [label + '_episodes', label + '_movies', label + '_albums']
try:
for entry in recent_cache:
recent_db = RecentlyAdded.query.filter(RecentlyAdded.name == entry).first()
if recent_db:
db_session.delete(recent_db)
db_session.commit()
except:
logger.log('Failed to remove servers database cache' , 'WARNING')
image_dir = os.path.join(maraschino.DATA_DIR, 'cache', 'xbmc', xbmc_server.label)
if os.path.isdir(image_dir):
import shutil
try:
shutil.rmtree(image_dir)
except:
logger.log('Failed to remove servers image cache' , 'WARNING')
return render_template('includes/servers.html',
servers = XbmcServer.query.order_by(XbmcServer.position),
)
except:
logger.log('Error deleting server ID %s' % server_id , 'WARNING')
return jsonify({ 'status': 'error' })
开发者ID:wjbridge,项目名称:maraschino,代码行数:40,代码来源:modules.py
示例10: legacy_disk_migrate
def legacy_disk_migrate():
logger.log('DISKSPACE :: Migrating legacy disks', 'INFO')
disks_db_old = Disk.query.order_by(Disk.position)
for disk_old in disks_db_old:
disk = HardDisk(
data={
'path': disk_old.path,
'name': disk_old.path,
'group': '',
},
position=disk_old.position
)
try:
db_session.add(disk)
db_session.delete(disk_old)
db_session.commit()
except:
return jsonify({'status': 'error'})
开发者ID:wjbridge,项目名称:maraschino,代码行数:22,代码来源:diskspace.py
示例11: delete_server
def delete_server(server_id=None):
"""
Deletes a server.
"""
try:
xbmc_server = XbmcServer.query.get(server_id)
db_session.delete(xbmc_server)
db_session.commit()
# Remove the server's cache
label = xbmc_server.label
recent_cache = [label + "_episodes", label + "_movies", label + "_albums"]
try:
for entry in recent_cache:
recent_db = RecentlyAdded.query.filter(RecentlyAdded.name == entry).first()
if recent_db:
db_session.delete(recent_db)
db_session.commit()
except:
logger.log("Failed to remove servers database cache", "WARNING")
image_dir = os.path.join(maraschino.DATA_DIR, "cache", "xbmc", xbmc_server.label)
if os.path.isdir(image_dir):
import shutil
try:
shutil.rmtree(image_dir)
except:
logger.log("Failed to remove servers image cache", "WARNING")
return render_template("includes/servers.html", servers=XbmcServer.query.order_by(XbmcServer.position))
except:
logger.log("Error deleting server ID %s" % server_id, "WARNING")
return jsonify({"status": "error"})
开发者ID:robweber,项目名称:maraschino,代码行数:38,代码来源:modules.py
注:本文中的maraschino.database.db_session.delete函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论