]> git.0d.be Git - django-panik-nonstop.git/commitdiff
adapt jingle methods to real contents of its filepath attribute
authorFrédéric Péters <fpeters@0d.be>
Thu, 21 May 2020 06:43:01 +0000 (08:43 +0200)
committerFrédéric Péters <fpeters@0d.be>
Thu, 21 May 2020 06:43:01 +0000 (08:43 +0200)
nonstop/models.py

index be7665ed1065e95c1fd901658da1abcfa585d566..013154c9214d560db92e04106c3b333f70674bc0 100644 (file)
@@ -184,7 +184,10 @@ class Jingle(models.Model):
 
     @property
     def short(self):
-        return self.filepath[len(REMOTE_BASE_PATH):]
+        # property for compatibility with Track model
+        # for jingles self.filepath is actually only the last part of the path,
+        # ex: jingles panik/H_marimba_RP_chucho_zoe.wav
+        return self.filepath
 
     def file_path(self):
         # for compatibility with Track model method
@@ -193,7 +196,7 @@ class Jingle(models.Model):
     def get_local_filepath(self):
         if not self.short:
             return None
-        return os.path.join(LOCAL_BASE_PATH, self.short)
+        return os.path.join(LOCAL_BASE_PATH, 'SPOTS', self.short)
 
     @property
     def title(self):