@command(('(%s{0,3})([-,\\d\\s\\[\\]]{1,250})\\s*(%s{0,3})$' % (RS, RS)))
def play(pre, choice, post=''):
 if (g.browse_mode == 'ytpl'):
  if choice.isdigit():
   return plist(g.ytpls[(int(choice) - 1)]['link'])
  else:
   g.message = ((('Invalid playlist selection: %s' % c.y) + choice) + c.w)
   g.content = content.generate_songlist_display()
   return
 if (not g.model):
  g.message = ((c.r + 'There are no tracks to select') + c.w)
  g.content = (g.content or content.generate_songlist_display())
 else:
  shuffle = ('shuffle' in (pre + post))
  repeat = ('repeat' in (pre + post))
  novid = ('-a' in (pre + post))
  fs = ('-f' in (pre + post))
  nofs = ('-w' in (pre + post))
  forcevid = ('-v' in (pre + post))
  if ((novid and fs) or (novid and nofs) or (nofs and fs) or (novid and forcevid)):
   raise IOError('Conflicting override options specified')
  override = False
  override = ('audio' if novid else override)
  override = ('fullscreen' if fs else override)
  override = ('window' if nofs else override)
  if ((not fs) and (not nofs)):
   override = ('forcevid' if forcevid else override)
  selection = util.parse_multi(choice)
  songlist = [g.model[(x - 1)] for x in selection]
  if (len(songlist) == 1):
   chosen = (selection[0] - 1)
   if (len(g.model) > (chosen + 1)):
    streams.preload(g.model[(chosen + 1)], override=override)
  play_range(songlist, shuffle, repeat, override)
  g.content = content.generate_songlist_display()

@ command ( ( '(%s{0,3})([-,\\d\\s\\[\\]]{1,250})\\s*(%s{0,3})$' % ( RS , RS ) ) ) def play ( pre , choice , post = '' ) : if ( g . browse_mode == 'ytpl' ) : if choice . isdigit ( ) : return plist ( g . ytpls [ ( int ( choice ) - 1 ) ] [ 'link' ] ) else : g . message = ( ( ( 'Invalid playlist selection: %s' % c . y ) + choice ) + c . w ) g . content = content . generate_songlist_display ( ) return if ( not g . model ) : g . message = ( ( c . r + 'There are no tracks to select' ) + c . w ) g . content = ( g . content or content . generate_songlist_display ( ) ) else : shuffle = ( 'shuffle' in ( pre + post ) ) repeat = ( 'repeat' in ( pre + post ) ) novid = ( '-a' in ( pre + post ) ) fs = ( '-f' in ( pre + post ) ) nofs = ( '-w' in ( pre + post ) ) forcevid = ( '-v' in ( pre + post ) ) if ( ( novid and fs ) or ( novid and nofs ) or ( nofs and fs ) or ( novid and forcevid ) ) : raise IOError ( 'Conflicting override options specified' ) override = False override = ( 'audio' if novid else override ) override = ( 'fullscreen' if fs else override ) override = ( 'window' if nofs else override ) if ( ( not fs ) and ( not nofs ) ) : override = ( 'forcevid' if forcevid else override ) selection = util . parse_multi ( choice ) songlist = [ g . model [ ( x - 1 ) ] for x in selection ] if ( len ( songlist ) == 1 ) : chosen = ( selection [ 0 ] - 1 ) if ( len ( g . model ) > ( chosen + 1 ) ) : streams . preload ( g . model [ ( chosen + 1 ) ] , override = override ) play_range ( songlist , shuffle , repeat , override ) g . content = content . generate_songlist_display ( )
play items in paths with command_str and optional arguments .