Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/develop' into feature/fu…
Browse files Browse the repository at this point in the history
…lly-vueify-notifications

# Conflicts:
#	themes/dark/assets/js/index.js.map
#	themes/dark/assets/js/vendors.js.map
#	themes/light/assets/js/index.js.map
#	themes/light/assets/js/vendors.js.map
  • Loading branch information
p0psicles committed Oct 29, 2018
2 parents 869c190 + 37efdc5 commit 8b10bb7
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 52 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## Unreleased

#### Improvements
- Vueified "config - notifications" page. Improved components: config-textbox, select-list, show-selector, config-textbox-number. Improved responsiveness of the notification page on smaller screens. ([#5159](https://github.com/pymedusa/Medusa/pull/4913))

#### Fixes


## 0.2.11 (2018-10-29)

#### New Features

#### Improvements
Expand All @@ -13,7 +21,6 @@
- Added support for SABnzbd's Direct Unpack feature ([#5385](https://github.com/pymedusa/Medusa/pull/5385))
- Added config/search values to apiv2 ([#5079](https://github.com/pymedusa/Medusa/pull/5079))
- Improved the add new show page responsiveness on smaller width viewports ([#5509](https://github.com/pymedusa/Medusa/pull/5509))
- Vueified "config - notifications" page. Improved components: config-textbox, select-list, show-selector, config-textbox-number. Improved responsiveness of the notification page on smaller screens. ([#5159](https://github.com/pymedusa/Medusa/pull/4913))

#### Fixes
- Fixed many release name parsing issues as a result of updating `guessit` ([#4244](https://github.com/pymedusa/Medusa/pull/4244))
Expand All @@ -27,6 +34,7 @@
- Fixed metadata settings not being saved ([#5385](https://github.com/pymedusa/Medusa/pull/5385))
- Fixed Synology DS missing location and wrong icon ([#5443](https://github.com/pymedusa/Medusa/pull/5443))
- Fixed saving "config - postprocessing frequency" value ([#5482](https://github.com/pymedusa/Medusa/pull/5482))
- Fixed database trying to update even if up to date ([#5543](https://github.com/pymedusa/Medusa/pull/5543))

-----

Expand Down
4 changes: 2 additions & 2 deletions medusa/databases/cache_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ def execute(self):
self.clear_provider_tables()
self.inc_major_version()

log.info('Updated to: {}.{}', *self.connection.version)

def clear_provider_tables(self):
providers = self.connection.select(
"SELECT name FROM sqlite_master WHERE type='table' AND name NOT IN ('lastUpdate',"
Expand All @@ -197,4 +195,6 @@ def inc_major_version(self):
major_version, minor_version = self.connection.version
major_version += 1
self.connection.action('UPDATE db_version SET db_version = ?;', [major_version])
log.info('[CACHE-DB] Updated major version to: {}.{}', *self.connection.version)

return self.connection.version
7 changes: 3 additions & 4 deletions medusa/databases/failed_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def execute(self):
' status NUMERIC DEFAULT -1, quality NUMERIC DEFAULT 0, showid NUMERIC DEFAULT -1,'
' season NUMERIC DEFAULT -1, episode NUMERIC DEFAULT -1);',),
('CREATE TABLE db_version (db_version INTEGER);',),
('INSERT INTO db_version (db_version) VALUES (1);',),
('INSERT INTO db_version (db_version) VALUES (2);',),
]
for query in queries:
if len(query) == 1:
Expand Down Expand Up @@ -125,7 +125,6 @@ def execute(self):
utils.backup_database(self.connection.path, self.connection.version)

self.translate_status()
self.inc_major_version()

def translate_status(self):
"""
Expand Down Expand Up @@ -159,6 +158,8 @@ def inc_major_version(self):
major_version, minor_version = self.connection.version
major_version += 1
self.connection.action('UPDATE db_version SET db_version = ?;', [major_version])
log.info(u'[FAILED-DB] Updated major version to: {}.{}', *self.connection.version)

return self.connection.version


Expand All @@ -176,8 +177,6 @@ def execute(self):
self.update_status_unknown()
self.inc_major_version()

log.info(u'Updated to: {}.{}', *self.connection.version)

def shift_history_qualities(self):
"""
Shift all qualities << 1.
Expand Down
54 changes: 17 additions & 37 deletions medusa/databases/main_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def execute(self):
self.connection.action(query)

else:
cur_db_version = self.checkDBVersion()
cur_db_version = self.checkMajorDBVersion()

if cur_db_version < MIN_DB_VERSION:
log.error(
Expand All @@ -283,38 +283,38 @@ def execute(self):

class AddVersionToTvEpisodes(InitialSchema):
def test(self):
return self.checkDBVersion() >= 40
return self.checkMajorDBVersion() >= 40

def execute(self):
utils.backup_database(self.connection.path, self.checkDBVersion())
utils.backup_database(self.connection.path, self.checkMajorDBVersion())

log.info(u'Adding column version to tv_episodes and history')
self.addColumn('tv_episodes', 'version', 'NUMERIC', '-1')
self.addColumn('tv_episodes', 'release_group', 'TEXT', '')
self.addColumn('history', 'version', 'NUMERIC', '-1')

self.incDBVersion()
self.incMajorDBVersion()


class AddDefaultEpStatusToTvShows(AddVersionToTvEpisodes):
def test(self):
return self.checkDBVersion() >= 41
return self.checkMajorDBVersion() >= 41

def execute(self):
utils.backup_database(self.connection.path, self.checkDBVersion())
utils.backup_database(self.connection.path, self.checkMajorDBVersion())

log.info(u'Adding column default_ep_status to tv_shows')
self.addColumn('tv_shows', 'default_ep_status', 'NUMERIC', '-1')

self.incDBVersion()
self.incMajorDBVersion()


class AlterTVShowsFieldTypes(AddDefaultEpStatusToTvShows):
def test(self):
return self.checkDBVersion() >= 42
return self.checkMajorDBVersion() >= 42

def execute(self):
utils.backup_database(self.connection.path, self.checkDBVersion())
utils.backup_database(self.connection.path, self.checkMajorDBVersion())

log.info(u'Converting column indexer and default_ep_status field types to numeric')
self.connection.action('DROP TABLE IF EXISTS tmp_tv_shows')
Expand All @@ -330,14 +330,14 @@ def execute(self):
self.connection.action('INSERT INTO tv_shows SELECT * FROM tmp_tv_shows')
self.connection.action('DROP TABLE tmp_tv_shows')

self.incDBVersion()
self.incMajorDBVersion()


class AddMinorVersion(AlterTVShowsFieldTypes):
def test(self):
return self.checkDBVersion() >= 43 and self.hasColumn('db_version', 'db_minor_version')
return self.checkMajorDBVersion() >= 43 and self.hasColumn('db_version', 'db_minor_version')

def incDBVersion(self):
def incMajorDBVersion(self):
warnings.warn('Deprecated: Use inc_major_version or inc_minor_version instead', DeprecationWarning)

def inc_major_version(self):
Expand All @@ -346,26 +346,28 @@ def inc_major_version(self):
minor_version = 0
self.connection.action('UPDATE db_version SET db_version = ?, db_minor_version = ?;',
[major_version, minor_version])
log.info(u'[MAIN-DB] Updated major version to: {}.{}', *self.connection.version)

return self.connection.version

def inc_minor_version(self):
major_version, minor_version = self.connection.version
minor_version += 1
self.connection.action('UPDATE db_version SET db_version = ?, db_minor_version = ?;',
[major_version, minor_version])
log.info(u'[MAIN-DB] Updated minor version to: {}.{}', *self.connection.version)

return self.connection.version

def execute(self):
utils.backup_database(self.connection.path, self.checkDBVersion())
utils.backup_database(self.connection.path, self.checkMajorDBVersion())

log.info(u'Add minor version numbers to database')
self.addColumn('db_version', 'db_minor_version')

self.inc_major_version()
self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class TestIncreaseMajorVersion(AddMinorVersion):
"""
Expand All @@ -390,8 +392,6 @@ def execute(self):
self.inc_major_version()
self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class AddProperTags(TestIncreaseMajorVersion):
"""Adds column proper_tags to history table."""
Expand All @@ -416,8 +416,6 @@ def execute(self):
MainSanityCheck(self.connection).update_old_propers()
self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class AddManualSearched(AddProperTags):
"""Adds columns manually_searched to history and tv_episodes table."""
Expand Down Expand Up @@ -445,8 +443,6 @@ def execute(self):
MainSanityCheck(self.connection).update_old_propers()
self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class AddInfoHash(AddManualSearched):
"""Adds column info_hash to history table."""
Expand All @@ -466,8 +462,6 @@ def execute(self):

self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class AddPlot(AddInfoHash):
"""Adds column plot to imdb_info table."""
Expand All @@ -491,8 +485,6 @@ def execute(self):

self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class AddResourceSize(AddPlot):
"""Adds column size to history table."""
Expand All @@ -512,8 +504,6 @@ def execute(self):

self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class AddPKIndexerMapping(AddResourceSize):
"""Add PK to mindexer column in indexer_mapping table."""
Expand All @@ -537,8 +527,6 @@ def execute(self):

self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class AddIndexerInteger(AddPKIndexerMapping):
"""Make indexer as INTEGER in tv_episodes table."""
Expand Down Expand Up @@ -567,8 +555,6 @@ def execute(self):

self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class AddIndexerIds(AddIndexerInteger):
"""
Expand Down Expand Up @@ -681,8 +667,6 @@ def create_series_dict():

self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)

# Flag the image migration.
from medusa import app
app.MIGRATE_IMAGES = True
Expand Down Expand Up @@ -753,8 +737,6 @@ def execute(self):

self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)


class ShiftQualities(AddSeparatedStatusQualityFields):
"""Shift all qualities one place to the left."""
Expand All @@ -771,8 +753,6 @@ def execute(self):
self.shift_history_qualities()
self.inc_minor_version()

log.info(u'Updated to: {}.{}', *self.connection.version)

def shift_tv_qualities(self):
"""
Shift all qualities << 1.
Expand Down
9 changes: 5 additions & 4 deletions medusa/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def checkDBVersion(self):
db_minor_version = self.check_db_minor_version()
if db_minor_version is None:
db_minor_version = 0

return self.check_db_major_version(), db_minor_version

def check_db_major_version(self):
Expand Down Expand Up @@ -490,10 +491,10 @@ def addColumn(self, table, column, column_type='NUMERIC', default=0):
self.connection.action('ALTER TABLE [%s] ADD %s %s' % (table, column, column_type))
self.connection.action('UPDATE [%s] SET %s = ?' % (table, column), (default,))

def checkDBVersion(self):
return self.connection.checkDBVersion()
def checkMajorDBVersion(self):
return self.connection.checkDBVersion()[0]

def incDBVersion(self):
new_version = self.checkDBVersion() + 1
def incMajorDBVersion(self):
new_version = self.checkMajorDBVersion() + 1
self.connection.action('UPDATE db_version SET db_version = ?', [new_version])
return new_version
Loading

0 comments on commit 8b10bb7

Please sign in to comment.