summaryrefslogtreecommitdiff
path: root/models/track.py
diff options
context:
space:
mode:
authorMichaël Ball <michael.ball@gmail.com>2015-08-09 14:44:55 +0100
committerMichaël Ball <michael.ball@gmail.com>2015-08-09 14:44:55 +0100
commit6b5c87d5c35ebbac6f7fbcac1a722bd0b3148e04 (patch)
treeefc2b776dad1307d4b8b78a517e9789852b4dc31 /models/track.py
parent122ec1c9b283776b8f1fea5559d4317bdba5b977 (diff)
Improve performance - introduce transactions
Diffstat (limited to 'models/track.py')
-rw-r--r--models/track.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/models/track.py b/models/track.py
index 854b3ee..8b16d26 100644
--- a/models/track.py
+++ b/models/track.py
@@ -72,6 +72,8 @@ class Track:
db = DbManager()
c = db.cursor()
+ c.execute("BEGIN TRANSACTION")
+
artist_names = metadata["artist"]
musicbrainz_artist_ids = []
artistsorts = []
@@ -257,6 +259,8 @@ class Track:
except apsw.ConstraintError:
pass
+ c.execute("COMMIT TRANSACTION")
+
return True
def save(self):
@@ -334,6 +338,8 @@ class Track:
db = DbManager()
c = db.cursor()
+ c.execute("BEGIN TRANSACTION")
+
artist_names = metadata["artist"]
musicbrainz_artist_ids = []
artistsorts = []
@@ -530,4 +536,6 @@ class Track:
except apsw.ConstraintError:
pass
+ c.execute("COMMIT TRANSACTION")
+
return True