#NEWLINE# @ transaction . commit_on_success #NEWLINE# def _handle_video( title , url , tags , timestamp ) : #NEWLINE# #INDENT# log . debug ( ( 'Handling video: %s' % smart_str ( tags ) ) ) #NEWLINE# source = VideoSource . objects . get ( name = 'YouTube' ) #NEWLINE# try : #NEWLINE# #INDENT# title = smart_unicode ( title ) #NEWLINE# #UNINDENT# except DjangoUnicodeDecodeError : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# ( vid , created ) = Video . objects . get_or_create ( url = url , defaults = { #NEWLINE# #INDENT# 'title' : title , #NEWLINE# 'source' : source , #NEWLINE# #UNINDENT# } ) #NEWLINE# if created : #NEWLINE# #INDENT# return Item . objects . create_or_update ( instance = vid , timestamp = timestamp , tags = tags , source = __name__ )