Skip to content

Commit

Permalink
add Ignore duplicates setting #32, update Trakt user lists #398
Browse files Browse the repository at this point in the history
  • Loading branch information
scakemyer committed Dec 16, 2016
1 parent 500b904 commit 371eff3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
4 changes: 4 additions & 0 deletions resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -589,3 +589,7 @@ msgstr "Reset clearances"
msgctxt "#30265"
msgid "Item already in library"
msgstr "Item already in library"

msgctxt "#30266"
msgid "Ignore duplicates"
msgstr "Ignore duplicates"
4 changes: 4 additions & 0 deletions resources/language/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -593,3 +593,7 @@ msgstr "Reset clearances"
msgctxt "#30265"
msgid "Item already in library"
msgstr "Item already in library"

msgctxt "#30266"
msgid "Ignore duplicates"
msgstr "Ignore duplicates"
7 changes: 4 additions & 3 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@
<setting type="action" label="30054" action="RunPlugin(plugin://plugin.video.quasar/library/update)" />
<setting id="library_update_delay" type="number" label="30059" default="300" />
<setting id="library_update_frequency" type="number" label="30060" default="8" />
<setting id="library_ignore_duplicates" type="bool" label="30266" default="true" />
<setting label="30056" type="lsep" />
<setting type="action" label="30058" action="RunPlugin(plugin://plugin.video.quasar/trakt/authorize)" />
<setting id="trakt_username" type="text" label="30057" default="" />
<setting id="trakt_token" type="text" label="Trakt token" default="" visible="false" />
<setting id="trakt_refresh_token" type="text" label="Trakt refresh token" default="" visible="false" />
<setting id="trakt_scrobble" type="bool" label="Scrobble" default="false" />
<setting id="trakt_sync" type="number" label="30061" default="0" />
<setting type="action" label="30058" action="RunPlugin(plugin://plugin.video.quasar/trakt/authorize)" />
<setting id="trakt_token" type="text" label="Trakt token" default="" visible="false" />
<setting id="trakt_refresh_token" type="text" label="Trakt refresh token" default="" visible="false" />
<setting label="CloudHole" type="lsep" />
<setting id="use_cloudhole" type="bool" label="30240" default="false" />
<setting id="cloudhole_key" type="text" label="30040" default="" />
Expand Down
19 changes: 11 additions & 8 deletions resources/site-packages/quasar/library.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import json
import xbmc
import time
import urllib2
from quasar.addon import ADDON
from quasar.config import QUASARD_HOST
from quasar.provider import closing

def library_thread():
trakt_sync = int(ADDON.getSetting("trakt_sync"))
Expand All @@ -14,14 +16,15 @@ def library_thread():
if count >= limit:
count = 0
try:
urllib2.urlopen(QUASARD_HOST + "/library/movie/watchlist/add")
time.sleep(10)
urllib2.urlopen(QUASARD_HOST + "/library/movie/collection/add")
time.sleep(10)
urllib2.urlopen(QUASARD_HOST + "/library/show/watchlist/add")
time.sleep(10)
urllib2.urlopen(QUASARD_HOST + "/library/show/collection/add")
time.sleep(10)
urllib2.urlopen(QUASARD_HOST + "/library/movie/watchlist/add?updating=true")
urllib2.urlopen(QUASARD_HOST + "/library/movie/collection/add?updating=true")
urllib2.urlopen(QUASARD_HOST + "/library/show/watchlist/add?updating=true")
urllib2.urlopen(QUASARD_HOST + "/library/show/collection/add?updating=true")
with closing(urllib2.urlopen(QUASARD_HOST + "/library/userlists")) as response:
data = json.loads(response.read())
for userlist in data:
urllib2.urlopen(QUASARD_HOST + "/library/movie/list/add/%d?updating=true" % userlist['IDs']['trakt'])
urllib2.urlopen(QUASARD_HOST + "/library/show/list/add/%d?updating=true" % userlist['IDs']['trakt'])
urllib2.urlopen(QUASARD_HOST + "/library/update")
except:
pass
Expand Down

0 comments on commit 371eff3

Please sign in to comment.