Compare commits
42
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6772b9d965 | ||
|
|
5df14d67e1 | ||
|
|
73abd1f022 | ||
|
|
e75a8529c9 | ||
|
|
07a7f8cbcf | ||
|
|
9b35a0fb20 | ||
|
|
0622e6e5ab | ||
|
|
f16931906f | ||
|
|
45b2dff6d2 | ||
|
|
30d56b5d2c | ||
|
|
5ff6824ae9 | ||
|
|
0210859155 | ||
|
|
665478db13 | ||
|
|
84c366ab54 | ||
|
|
908e5eae77 | ||
|
|
1d448f3d9c | ||
|
|
338b5f427a | ||
|
|
59e3e73c4c | ||
|
|
cb2614127c | ||
|
|
fdbd826917 | ||
|
|
31daf4915e | ||
|
|
4ca7691afd | ||
|
|
64d3ecd9b8 | ||
|
|
d55df3240f | ||
|
|
52214e4938 | ||
|
|
b45307e493 | ||
|
|
4320369448 | ||
|
|
f560dc093c | ||
|
|
d26a2b1480 | ||
|
|
e11b07b559 | ||
|
|
b6ee8ef4d4 | ||
|
|
f80559d380 | ||
|
|
8530b00e7b | ||
|
|
5851e1e69f | ||
|
|
686bfd62eb | ||
|
|
9b82603c26 | ||
|
|
f41792915f | ||
|
|
2fa77fb610 | ||
|
|
e64d0e33fc | ||
|
|
b168643600 | ||
|
|
240283405e | ||
|
|
b69f8b7ed5 |
+4
-1
@@ -163,6 +163,7 @@ class CouchPotatoApp(wx.App, SoftwareUpdate):
|
|||||||
events = {}
|
events = {}
|
||||||
restart = False
|
restart = False
|
||||||
closing = False
|
closing = False
|
||||||
|
triggered_onClose = False
|
||||||
|
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
|
|
||||||
@@ -198,7 +199,9 @@ class CouchPotatoApp(wx.App, SoftwareUpdate):
|
|||||||
self.closing = True
|
self.closing = True
|
||||||
self.frame.tbicon.onTaskBarClose(event)
|
self.frame.tbicon.onTaskBarClose(event)
|
||||||
|
|
||||||
onClose = self.events.get('onClose')
|
onClose = self.events.get('onClose')
|
||||||
|
if onClose and not self.triggered_onClose:
|
||||||
|
self.triggered_onClose = True
|
||||||
onClose(event)
|
onClose(event)
|
||||||
|
|
||||||
def afterShutdown(self, restart = False):
|
def afterShutdown(self, restart = False):
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class Updater(Plugin):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def doShutdown(self, *args, **kwargs):
|
def doShutdown(self, *args, **kwargs):
|
||||||
if not Env.get('dev'):
|
if not Env.get('dev') and not Env.get('desktop'):
|
||||||
removePyc(Env.get('app_dir'), show_logs = False)
|
removePyc(Env.get('app_dir'), show_logs = False)
|
||||||
|
|
||||||
return super(Updater, self).doShutdown(*args, **kwargs)
|
return super(Updater, self).doShutdown(*args, **kwargs)
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ import os
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
from CodernityDB.database import RecordNotFound
|
||||||
from CodernityDB.index import IndexException, IndexNotFoundException, IndexConflict
|
from CodernityDB.index import IndexException, IndexNotFoundException, IndexConflict
|
||||||
from couchpotato import CPLog
|
from couchpotato import CPLog
|
||||||
from couchpotato.api import addApiView
|
from couchpotato.api import addApiView
|
||||||
from couchpotato.core.event import addEvent, fireEvent
|
from couchpotato.core.event import addEvent, fireEvent, fireEventAsync
|
||||||
from couchpotato.core.helpers.encoding import toUnicode, sp
|
from couchpotato.core.helpers.encoding import toUnicode, sp
|
||||||
from couchpotato.core.helpers.variable import getImdb, tryInt
|
from couchpotato.core.helpers.variable import getImdb, tryInt
|
||||||
|
|
||||||
@@ -226,6 +227,34 @@ class Database(object):
|
|||||||
from couchpotato import Env
|
from couchpotato import Env
|
||||||
|
|
||||||
db = self.getDB()
|
db = self.getDB()
|
||||||
|
|
||||||
|
# Try fix for migration failures on desktop
|
||||||
|
if Env.get('desktop'):
|
||||||
|
try:
|
||||||
|
list(db.all('profile', with_doc = True))
|
||||||
|
except RecordNotFound:
|
||||||
|
|
||||||
|
failed_location = '%s_failed' % db.path
|
||||||
|
old_db = os.path.join(Env.get('data_dir'), 'couchpotato.db.old')
|
||||||
|
|
||||||
|
if not os.path.isdir(failed_location) and os.path.isfile(old_db):
|
||||||
|
log.error('Corrupt database, trying migrate again')
|
||||||
|
db.close()
|
||||||
|
|
||||||
|
# Rename database folder
|
||||||
|
os.rename(db.path, '%s_failed' % db.path)
|
||||||
|
|
||||||
|
# Rename .old database to try another migrate
|
||||||
|
os.rename(old_db, old_db[:-4])
|
||||||
|
|
||||||
|
fireEventAsync('app.restart')
|
||||||
|
else:
|
||||||
|
log.error('Migration failed and couldn\'t recover database. Please report on GitHub, with this message.')
|
||||||
|
db.reindex()
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
# Check size and compact if needed
|
||||||
size = db.get_db_details().get('size')
|
size = db.get_db_details().get('size')
|
||||||
prop_name = 'last_db_compact'
|
prop_name = 'last_db_compact'
|
||||||
last_check = int(Env.prop(prop_name, default = 0))
|
last_check = int(Env.prop(prop_name, default = 0))
|
||||||
@@ -303,6 +332,8 @@ class Database(object):
|
|||||||
log.info('Getting data took %s', time.time() - migrate_start)
|
log.info('Getting data took %s', time.time() - migrate_start)
|
||||||
|
|
||||||
db = self.getDB()
|
db = self.getDB()
|
||||||
|
if not db.opened:
|
||||||
|
return
|
||||||
|
|
||||||
# Use properties
|
# Use properties
|
||||||
properties = migrate_data['properties']
|
properties = migrate_data['properties']
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ autoload = 'FanartTV'
|
|||||||
class FanartTV(MovieProvider):
|
class FanartTV(MovieProvider):
|
||||||
|
|
||||||
urls = {
|
urls = {
|
||||||
'api': 'http://api.fanart.tv/webservice/movie/b28b14e9be662e027cfbc7c3dd600405/%s/JSON/all/1/2'
|
'api': 'http://webservice.fanart.tv/v3/movies/%s?api_key=b28b14e9be662e027cfbc7c3dd600405'
|
||||||
}
|
}
|
||||||
|
|
||||||
MAX_EXTRAFANART = 20
|
MAX_EXTRAFANART = 20
|
||||||
@@ -36,9 +36,8 @@ class FanartTV(MovieProvider):
|
|||||||
fanart_data = self.getJsonData(url)
|
fanart_data = self.getJsonData(url)
|
||||||
|
|
||||||
if fanart_data:
|
if fanart_data:
|
||||||
name, resource = fanart_data.items()[0]
|
log.debug('Found images for %s', fanart_data.get('name'))
|
||||||
log.debug('Found images for %s', name)
|
images = self._parseMovie(fanart_data)
|
||||||
images = self._parseMovie(resource)
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
log.error('Failed getting extra art for %s: %s',
|
log.error('Failed getting extra art for %s: %s',
|
||||||
@@ -95,7 +94,7 @@ class FanartTV(MovieProvider):
|
|||||||
for image in images:
|
for image in images:
|
||||||
if tryInt(image.get('likes')) > highscore:
|
if tryInt(image.get('likes')) > highscore:
|
||||||
highscore = tryInt(image.get('likes'))
|
highscore = tryInt(image.get('likes'))
|
||||||
image_url = image.get('url')
|
image_url = image.get('url') or image.get('href')
|
||||||
|
|
||||||
return image_url
|
return image_url
|
||||||
|
|
||||||
@@ -118,7 +117,9 @@ class FanartTV(MovieProvider):
|
|||||||
if tryInt(image.get('likes')) > highscore:
|
if tryInt(image.get('likes')) > highscore:
|
||||||
highscore = tryInt(image.get('likes'))
|
highscore = tryInt(image.get('likes'))
|
||||||
best = image
|
best = image
|
||||||
image_urls.append(best.get('url'))
|
url = best.get('url') or best.get('href')
|
||||||
|
if url:
|
||||||
|
image_urls.append(url)
|
||||||
pool.remove(best)
|
pool.remove(best)
|
||||||
|
|
||||||
return image_urls
|
return image_urls
|
||||||
|
|||||||
@@ -87,6 +87,13 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
|
|||||||
|
|
||||||
# Do db stuff
|
# Do db stuff
|
||||||
db_path = sp(os.path.join(data_dir, 'database'))
|
db_path = sp(os.path.join(data_dir, 'database'))
|
||||||
|
old_db_path = os.path.join(data_dir, 'couchpotato.db')
|
||||||
|
|
||||||
|
# Remove database folder if both exists
|
||||||
|
if os.path.isdir(db_path) and os.path.isfile(old_db_path):
|
||||||
|
db = SuperThreadSafeDatabase(db_path)
|
||||||
|
db.open()
|
||||||
|
db.destroy()
|
||||||
|
|
||||||
# Check if database exists
|
# Check if database exists
|
||||||
db = SuperThreadSafeDatabase(db_path)
|
db = SuperThreadSafeDatabase(db_path)
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#define MyAppName "CouchPotato"
|
#define MyAppName "CouchPotato"
|
||||||
#define MyAppVer "2.5.0"
|
#define MyAppVer "2.5.2"
|
||||||
#define MyAppBit "win32"
|
#define MyAppBit "win32"
|
||||||
//#define MyAppBit "win-amd64"
|
//#define MyAppBit "win-amd64"
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
VERSION = '2.5.0'
|
VERSION = '2.5.2'
|
||||||
BRANCH = 'desktop'
|
BRANCH = 'desktop'
|
||||||
|
|||||||
Reference in New Issue
Block a user