Permalink
Browse files

Remove incorrect queryset() method for SL admins.

Also a bit of cleanup.
  • Loading branch information...
1 parent 00fd22a commit 673a6b443580fdf76dcbf95df75727b68c4ea04f @sjl sjl committed Aug 23, 2012
Showing with 13 additions and 9 deletions.
  1. +0 −4 apps/subtitles/admin.py
  2. +3 −0 apps/subtitles/models.py
  3. +5 −5 apps/subtitles/pipeline.py
  4. +5 −0 libs/dxfpy/dxfpy.py
View
4 apps/subtitles/admin.py
@@ -35,10 +35,6 @@ class SubtitleLanguageAdmin(admin.ModelAdmin):
search_fields = ['video__title', 'video__video_id', 'language_code']
raw_id_fields = ['video', 'followers', 'collaborators']
- def queryset(self, request):
- return SubtitleLanguage.objects.with_signoff_counts()
-
-
def unofficial_signoffs(self, o):
return o.unofficial_signoff_count
unofficial_signoffs.admin_order_field = 'unofficial_signoff_count'
View
3 apps/subtitles/models.py
@@ -126,8 +126,11 @@ class SubtitleLanguage(models.Model):
video = models.ForeignKey(Video, related_name='newsubtitlelanguage_set')
language_code = models.CharField(max_length=16, choices=ALL_LANGUAGES)
+ # TODO: Remove followers?
followers = models.ManyToManyField(User, blank=True,
related_name='followed_newlanguages')
+
+ # TODO: Remove followers?
collaborators = models.ManyToManyField(User, blank=True,
related_name='collab_newlanguages')
View
10 apps/subtitles/pipeline.py
@@ -79,7 +79,7 @@ def _get_language(video, language_code):
return sl, language_needs_save
-def _add_subtitles(video, language_code):
+def _add_subtitles(video, language_code, subtitles):
"""Add subtitles in the language to the video. Really.
This function is the meat of the subtitle pipeline. The user-facing
@@ -97,7 +97,7 @@ def _add_subtitles(video, language_code):
# Public API ------------------------------------------------------------------
-def add_subtitles_unsafe(video, language_code):
+def add_subtitles_unsafe(video, language_code, subtitles):
"""Add subtitles in the language to the video without a transaction.
You probably want to use add_subtitles instead, but if you're already inside
@@ -108,9 +108,9 @@ def add_subtitles_unsafe(video, language_code):
future.
"""
- return _add_subtitles(video, language_code)
+ return _add_subtitles(video, language_code, subtitles)
-def add_subtitles(video, language_code):
+def add_subtitles(video, language_code, subtitles):
"""Add subtitles in the language to the video. It all starts here.
This function is your main entry point to the subtitle pipeline.
@@ -126,4 +126,4 @@ def add_subtitles(video, language_code):
"""
with transaction.commit_on_success():
- return _add_subtitles(video, language_code)
+ return _add_subtitles(video, language_code, subtitles)
View
5 libs/dxfpy/dxfpy.py
@@ -152,6 +152,11 @@ def from_list(cls, subtitles):
Each tuple should be (from_ms, to_ms, content). See the docstring of
append_subtitle for more information.
+ For example:
+
+ [(0, 1000, "Hello, "),
+ (1100, None, "world!")]
+
"""
subs = SubtitleSet()

0 comments on commit 673a6b4

Please sign in to comment.