Skip to content

html5 transcript exists - #9924

Merged
Shrhawk merged 1 commit into
masterfrom
shr/bug/TNL-3168-import_from_youtube_html5_subs
Nov 6, 2015
Merged

html5 transcript exists#9924
Shrhawk merged 1 commit into
masterfrom
shr/bug/TNL-3168-import_from_youtube_html5_subs

Conversation

@Shrhawk

@Shrhawk Shrhawk commented Sep 28, 2015

Copy link
Copy Markdown
Contributor

TNL-3168

Steps to Reproduce:
1.Create a video component with youtube and html(mp4) url
2.Save the component
3.Edit the component and click import from youtube(transcript)
4.Go to assets page of an course (transcript with youtube_id only)
Problem:
editor_saved is not syncing subs for an edge case above.
Solution:
At editor_saved check if youtube_sub already exists and there is no html5_subs present for html5_resources then create new html5_subs.

@Shrhawk

Shrhawk commented Sep 30, 2015

Copy link
Copy Markdown
Contributor Author

jenkins run bokchoy

@Shrhawk
Shrhawk force-pushed the shr/bug/TNL-3168-import_from_youtube_html5_subs branch 2 times, most recently from 73f0f3e to c386011 Compare October 8, 2015 13:47
@Shrhawk

Shrhawk commented Oct 8, 2015

Copy link
Copy Markdown
Contributor Author

@adampalay @waheedahmed @mushtaqak have a review !

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why old_metadata.get('html5_sources', [])? Why not old_metadata.get('html5_sources', False) or just old_metadata.get('html5_sources')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok will replace with old_metadata.get('html5_sources', False)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

html5_sources is a list and i prefer to set the default values accordingly.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old_metadata.get('html5_sources') this is fine too.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you shed some light on this self.sub, what's the purpose ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of self.sub is to check that there should transcript attached to video and then we will sure this this part of code will only run when there is already transcript present because we need transcript for copy or renaming with different htmls_id.

@Shrhawk

Shrhawk commented Oct 22, 2015

Copy link
Copy Markdown
Contributor Author

@muzaffaryousaf, @muhammad-ammar kindly review !

@Shrhawk

Shrhawk commented Oct 26, 2015

Copy link
Copy Markdown
Contributor Author

@muzaffaryousaf kindly review !

@muzaffaryousaf

Copy link
Copy Markdown

@Shrhawk Sure. I will take a look in early morning.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shrhawk Do we have unit test coverage for this newly added code, if not, can we add some unit tests ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NVM, i see you have added the tests.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we get html5_sources from self/item instead of old_metadata because manage_video_subtitles_save uses item.html5_sources method instead of old_metadata to copy/rename, if values are different for both the result will be unexpected.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same call is happening in manage_video_subtitles_save method, it will be nice if we can reduce the call, somehow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great !!

@muzaffaryousaf

Copy link
Copy Markdown

@Shrhawk I'm done with first pass, let me know when you are done with changes.
Thanks.

@Shrhawk

Shrhawk commented Oct 30, 2015

Copy link
Copy Markdown
Contributor Author

@muzaffaryousaf i have make changes kindly review it !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adampalay add both module-stores as you suggested !

@adampalay

Copy link
Copy Markdown
Contributor

@Shrhawk , looks like you need to address 3 quality violations:

19:58:32 common/lib/xmodule/xmodule/video_module/video_module.py (94.4%):
19:58:32     432: C7630: (literal-used-as-attribute), VideoDescriptor.editor_saved: getattr using a literal attribute name
19:58:32 lms/djangoapps/courseware/tests/test_video_mongo.py (97.3%):
19:58:32     895: E1120: (no-value-for-parameter), TestEditorSavedMethod.setUp: No value for argument 'self' in unbound method call
19:58:32     905: C0103: (invalid-name), TestEditorSavedMethod.test_editor_saved_when_html5_sub_not_exist: Invalid attribute name "MODULESTORE"

Otherwise, this looks good.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shrhawk getattr(self, 'html5_sources') will raise AttributeError if self don't have html5_sources attribute.
https://docs.python.org/2/library/functions.html#getattr

@muzaffaryousaf

Copy link
Copy Markdown

@Shrhawk 👍 Good to go once you fix the quality issue and one inline comment & don't forget to squash the commits. Thanks.

@Shrhawk

Shrhawk commented Nov 2, 2015

Copy link
Copy Markdown
Contributor Author

@adampalay done thumps up ?

@Shrhawk
Shrhawk force-pushed the shr/bug/TNL-3168-import_from_youtube_html5_subs branch 2 times, most recently from 1587512 to 378b332 Compare November 2, 2015 13:43

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since [] if falsey, you should instead use hasattr(self, 'html5_sources'). Then in the next line, you don't need to use getattr.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done @adampalay have a review again !

@Shrhawk
Shrhawk force-pushed the shr/bug/TNL-3168-import_from_youtube_html5_subs branch from 340a02b to f92a766 Compare November 3, 2015 12:51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you've already checked that self has html5_sources, so you don't need getattr here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice finding :)

@adampalay

Copy link
Copy Markdown
Contributor

not sure why tests failed...

@Shrhawk

Shrhawk commented Nov 4, 2015

Copy link
Copy Markdown
Contributor Author

jenkins run python

@Shrhawk

Shrhawk commented Nov 4, 2015

Copy link
Copy Markdown
Contributor Author

jenkins run bokchoy

@Shrhawk

Shrhawk commented Nov 5, 2015

Copy link
Copy Markdown
Contributor Author

@adampalay tests are passing now !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants