Commit graph

3358 commits

Author SHA1 Message Date
Chuddah
0a69894320 Attempt to reduce the number of calls to execute and fetchone.
Profiling has shown that there are many calls to sqlite3.execute and
fetchone which takes a signicant amount of time. A simple way of
reducing these is to swap the 2-stage init of table row data into a
unified add.

Applying this to add_set and add_country yielded these results:

Before changes
```
281784    7.054    0.000    7.054    0.000 {method 'execute' of 'sqlite3.Cursor' objects}
127443    1.114    0.000    1.114    0.000 {method 'fetchone' of 'sqlite3.Cursor' objects}
```

After changes
```
281714    7.492    0.000    7.492    0.000 {method 'execute' of 'sqlite3.Cursor' objects}
127373    1.217    0.000    1.217    0.000 {method 'fetchone' of 'sqlite3.Cursor' objects}
```

Note: The total time of fetchone has actually increased. I am hoping
this was an abnormality on my machine and the actual reduction in the
number of calls will permantly reduce this total time.
2020-02-23 18:00:38 +00:00
Matt
19ec48cd5b Use six library instead of checking sys version 2020-02-23 00:07:44 -05:00
Matt
5479ba2775 Make commands python 2/3 compatible 2020-02-22 23:23:14 -05:00
mcarlton00
0e4458fa75
Merge pull request #193 from druscoe/inefficeint_usage_of_json_dumps_in_debug_output
Replaced debug output of json.dumps with an indirection to lazy __str__.
2020-02-22 14:50:49 -05:00
Chuddah
de493d13dd Moved JsonDebugPrinter to existing utils module 2020-02-22 15:04:28 +00:00
mcarlton00
4d4f45cd42
Merge pull request #202 from druscoe/threaded_http_gets
Parallelize multiple http GETs
2020-02-20 20:12:29 -05:00
Abby Gourlay
e5cde15ad2 Added a missing file 2020-02-21 00:50:32 +00:00
Abby Gourlay
417b9fb938 Recreated Branch 2020-02-21 00:42:50 +00:00
mcarlton00
2fbdd191d5
Merge pull request #201 from druscoe/in_progress_ui_updates
Allow for UI updates as the library is being sync'ed
2020-02-20 19:20:07 -05:00
Daniel De Jesus
69c467ae4a Translated using Weblate (Spanish (Dominican Republic))
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/es_DO/
2020-02-19 22:18:10 -05:00
Damien Ruscoe
756991e9ec
Resort to the expensive database lookup only if the person exists in the (#200)
* Added profiling info

* Resort to the expensive database lookup only if the person exists in the
database.

* Prevent any access to the people database unless a person must be added.

* Bulk operations where possible.

* Prepare for a new install and the table not existing.
2020-02-19 19:28:47 -05:00
Chuddah
bf46548365 Removed previous fixup.
The recursive call to get_workers was implemented as it looked like the
original intent of the DTHREADS variable. Otherwise this variable was
redundant. The ThreadPool is a much better use of this setting.
2020-02-19 23:23:21 +00:00
Chuddah
ce10cb88c2 Merge branch 'master' into threaded_http_gets 2020-02-19 23:11:05 +00:00
Chuddah
302880f67a Parallelize multiple http GET requests
Added ThreadPoolExecutor and used to process GET requests in multiple
threads which enables chunks of data to always be available for
processing. Processing of the data can happen as soon as the first chunk
arrives.

Refactored the code to help implement. The idea is the "params" are
built in batch and passed to the thread pool which get the actual
results.
2020-02-19 22:18:54 +00:00
Daniel De Jesus
4974d823d4 Added translation using Weblate (Spanish (Dominican Republic)) 2020-02-18 21:25:26 -05:00
mcarlton00
de70d9ac60
Merge pull request #197 from druscoe/fix_empty_download_thread_list
Move the responsibility of the maximum number of threads to the UI.
2020-02-18 20:03:44 -05:00
Chuddah
af810861c8 Allow for UI updates as the library is being sync'ed
Periodically release the locks on the database as the sync with the
server is being performed. This allows the UI to communicate with its
database and update the UI in real time.

Taken this oppurtunity to refactor some common code improve
maintainance.
2020-02-18 23:23:47 +00:00
Chuddah
2bf2206a1e Move the responsibility of the maximum number of threads to the UI.
Previously the user was able to set any number to limitThreads UI
component but internally that was reduced to be a maximum of 50 which is
deceiving to the user. Set this is set as a boundary in the UI.

This also fixes a bug that the user could set the number of threads to
zero which follows from GIGO; but let the UI assist by placing a min
number of threads to 1.
2020-02-17 11:59:48 +00:00
mcarlton00
5fc60fce6b
Merge pull request #195 from druscoe/fix_empty_download_thread_list
Fix empty download thread list
2020-02-16 19:16:21 -05:00
mcarlton00
c25d06ac80
Merge pull request #194 from druscoe/bug_fixes
Dont modify a list as you are traversing it.
2020-02-16 19:10:00 -05:00
Chuddah
4649d2371f Keep adding threads until the user limit has been reached 2020-02-16 23:39:27 +00:00
Chuddah
b878a0e433 Added download thread to the download_threads when created. 2020-02-16 22:56:46 +00:00
Chuddah
b9817a5617 Revert "Replaced debug output of json.dumps with an indirection to lazy __str__."
This reverts commit 78fda95853.

Committed on the wrong branch.
2020-02-16 22:22:23 +00:00
Chuddah
7491000a13 Replaced debug output of json.dumps with an indirection to lazy __str__.
json.dumps is a processing intensive operation. This is being called
every time data is received from the server (most noticeably during
library updates) for debug logging. If the user has debug logging
disabled (the default option) then the user is still paying for
processing which is discarded.

The fix is to add a level of indirection where the dumps function is
only called if a string representation of the json is requested; ie.
when the debug string is evaluated.
2020-02-16 22:17:05 +00:00
Chuddah
78fda95853 Replaced debug output of json.dumps with an indirection to lazy __str__.
json.dumps is a processing intensive operation. This is being called
every time data is received from the server (most noticeably during
library updates) for debug logging. If the user has debug logging
disabled (the default option) then the user is still paying for
processing which is discarded.

The fix is to add a level of indirection where the dumps function is
only called if a string representation of the json is requested; ie.
when the debug string is evaluated.
2020-02-16 22:07:56 +00:00
Chuddah
85d4e660ef Dont modify a list as you are traversing it. The result is
implementation dependant although with CPython elements are
unintentionally skipped during iteration.

Basic CPython example:

>>> A = [1,2,3,4,5,6]
>>> for a in A:
...     A.remove(a)
>>> A
[2, 4, 6]
2020-02-16 18:41:14 +00:00
mcarlton00
94456ddcd8
Merge pull request #192 from mcarlton00/fix-remote-crash
Fix playlist paths
2020-02-15 11:22:18 -05:00
mcarlton00
0b3319a01a
Merge pull request #190 from mcarlton00/obj-error
Obj error
2020-02-15 11:21:57 -05:00
mcarlton00
c1b18ca1cd
Merge pull request #188 from mcarlton00/kodi19-websocket
Fix kodi 19 websocket control
2020-02-15 11:21:41 -05:00
NeroBurner
406f9bbab2 Translated using Weblate (German)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/de/
2020-02-14 22:50:06 -05:00
mcarlton00
0bd378f9c9 Fix playlist paths 2020-02-14 20:15:14 -05:00
mcarlton00
ba6242dd93 Fixing indentation 2020-02-13 19:43:29 -05:00
mcarlton00
c6a701a4a3 Fix library object types 2020-02-13 19:39:38 -05:00
mcarlton00
e30e6dca8a Add link to magic string 2020-02-12 17:22:49 -05:00
mcarlton00
07c9fffab7 Fix kodi 19 websocket control 2020-02-11 23:09:55 -05:00
Libor Filípek
82910c6b2d Translated using Weblate (Czech)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/cs/
2020-02-10 14:17:50 -05:00
Libor Filípek
90293c3696 Translated using Weblate (Czech)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/cs/
2020-02-09 07:17:49 -05:00
Libor Filípek
5e6e8836a1 Translated using Weblate (Czech)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/cs/
2020-02-06 09:17:44 -05:00
Libor Filípek
f6ec3bf495 Translated using Weblate (Czech)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/cs/
2020-02-04 01:17:41 -05:00
DJSweder
0e5e6ec9b2 Translated using Weblate (Czech)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/cs/
2020-02-04 01:17:41 -05:00
Nutjob
f4767eea86 Translated using Weblate (Italian)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/it/
2020-02-04 01:17:40 -05:00
Libor Filípek
fdd19dd21b Translated using Weblate (Czech)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/cs/
2020-01-31 07:17:38 -05:00
Libor Filípek
a486097767 Added translation using Weblate (Czech) 2020-01-28 18:38:57 -05:00
Philmo67
576395df7c Translated using Weblate (French)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/fr/
2020-01-21 12:17:16 -05:00
Thoscellen
5203ab68ee Translated using Weblate (French)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/fr/
2020-01-20 11:55:27 -05:00
Philmo67
7d75e35183 Translated using Weblate (French)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/fr/
2020-01-20 11:55:27 -05:00
Thoscellen
bf69e2ff3e Translated using Weblate (French)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/fr/
2020-01-20 11:54:59 -05:00
Philmo67
dbbc0c29cb Translated using Weblate (French)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/fr/
2020-01-20 11:54:59 -05:00
NunzioArdi
611daee739 Translated using Weblate (French)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/fr/
2020-01-17 13:17:09 -05:00
Decoy7
9762e92e77 Translated using Weblate (Greek)
Translation: Jellyfin/Jellyfin Kodi
Translate-URL: https://translate.jellyfin.org/projects/jellyfin/jellyfin-kodi/el/
2020-01-15 09:17:07 -05:00