Beispiel #1
0
 def subtitles(self, subtitles_to_use=None):
     if self.pk:
         # if this collection hasn't been saved, then subtitle_set.all will return all subtitles
         # which will take too long / never return
         subtitles = subtitles_to_use or self.subtitle_set.all()
     else:
         subtitles = subtitles_to_use or []
     if not self.is_dependent():
         return [EffectiveSubtitle.for_subtitle(s) for s in subtitles]
     else:
         standard_collection = self._get_standard_collection()
         if not standard_collection:
             return []
         else:
             t_dict = \
                 dict([(s.subtitle_id, s) for s
                       in subtitles])
             subs = [
                 s for s in standard_collection.subtitle_set.all()
                 if s.subtitle_id in t_dict
             ]
             return [
                 EffectiveSubtitle.for_dependent_translation(
                     s, t_dict[s.subtitle_id]) for s in subs
             ]
Beispiel #2
0
 def subtitles(self):
     if not self.is_dependent():
         return [EffectiveSubtitle.for_subtitle(s)
                 for s in self.subtitle_set.all()]
     else:
         standard_collection = self._get_standard_collection()
         if not standard_collection:
             return []
         else:
             t_dict = \
                 dict([(s.subtitle_id, s) for s
                       in self.subtitle_set.all()])
             subs = [s for s in standard_collection.subtitle_set.all()
                     if s.subtitle_id in t_dict]
             return [EffectiveSubtitle.for_dependent_translation(
                     s, t_dict[s.subtitle_id]) for s in subs]
Beispiel #3
0
 def subtitles(self, subtitles_to_use=None):
     subtitles = subtitles_to_use or self.subtitle_set.all()
     if not self.is_dependent():
         return [EffectiveSubtitle.for_subtitle(s)
                 for s in subtitles]
     else:
         standard_collection = self._get_standard_collection()
         if not standard_collection:
             return []
         else:
             t_dict = \
                 dict([(s.subtitle_id, s) for s
                       in subtitles])
             subs = [s for s in standard_collection.subtitle_set.all()
                     if s.subtitle_id in t_dict]
             return [EffectiveSubtitle.for_dependent_translation(
                     s, t_dict[s.subtitle_id]) for s in subs]
 def _subtitles(self, version):
     subtitles = version.subtitle_set.all()
     if not self._is_dependent(version.language):
         return [EffectiveSubtitle.for_subtitle(s) for s in subtitles]
     else:
         standard_lang = version.language.standard_language
         if not standard_lang:
             return []
         standard_version = self._latest_version(standard_lang)
         if not standard_version:
             return []
         t_dict = \
             dict([(s.subtitle_id, s) for s
                   in subtitles])
         subs = [s for s in standard_version.subtitle_set.all()
                 if s.subtitle_id in t_dict]
         return [EffectiveSubtitle.for_dependent_translation(
                 s, t_dict[s.subtitle_id]) for s in subs]
Beispiel #5
0
 def _subtitles(self, version):
     subtitles = version.subtitle_set.all()
     if not self._is_dependent(version.language):
         return [EffectiveSubtitle.for_subtitle(s) for s in subtitles]
     else:
         standard_lang = version.language.standard_language
         if not standard_lang:
             return []
         standard_version = self._latest_version(standard_lang)
         if not standard_version:
             return []
         t_dict = \
             dict([(s.subtitle_id, s) for s
                   in subtitles])
         subs = [
             s for s in standard_version.subtitle_set.all()
             if s.subtitle_id in t_dict
         ]
         return [
             EffectiveSubtitle.for_dependent_translation(
                 s, t_dict[s.subtitle_id]) for s in subs
         ]
Beispiel #6
0
 def subtitles(self, subtitles_to_use=None):
     if  self.pk:
         # if this collection hasn't been saved, then subtitle_set.all will return all subtitles
         # which will take too long / never return
         subtitles = subtitles_to_use or self.subtitle_set.all()
     else:
         subtitles = subtitles_to_use or []
     if not self.is_dependent():
         return [EffectiveSubtitle.for_subtitle(s)
                 for s in subtitles]
     else:
         standard_collection = self._get_standard_collection()
         if not standard_collection:
             return []
         else:
             t_dict = \
                 dict([(s.subtitle_id, s) for s
                       in subtitles])
             subs = [s for s in standard_collection.subtitle_set.all()
                     if s.subtitle_id in t_dict]
             return [EffectiveSubtitle.for_dependent_translation(
                     s, t_dict[s.subtitle_id]) for s in subs]