@command('(mv|sw)\\s*(\\d{1,4})\\s*[\\s,]\\s*(\\d{1,4})')
def songlist_mv_sw(action, a, b):
 (i, j) = ((int(a) - 1), (int(b) - 1))
 if (action == 'mv'):
  g.model.songs.insert(j, g.model.songs.pop(i))
  g.message = (util.F('song move') % (g.model[j].title, b))
 elif (action == 'sw'):
  (g.model[i], g.model[j]) = (g.model[j], g.model[i])
  g.message = (util.F('song sw') % (min(a, b), max(a, b)))
 g.content = content.generate_songlist_display()

@ command ( '(mv|sw)\\s*(\\d{1,4})\\s*[\\s,]\\s*(\\d{1,4})' ) def songlist_mv_sw ( action , a , b ) : ( i , j ) = ( ( int ( a ) - 1 ) , ( int ( b ) - 1 ) ) if ( action == 'mv' ) : g . model . songs . insert ( j , g . model . songs . pop ( i ) ) g . message = ( util . F ( 'song move' ) % ( g . model [ j ] . title , b ) ) elif ( action == 'sw' ) : ( g . model [ i ] , g . model [ j ] ) = ( g . model [ j ] , g . model [ i ] ) g . message = ( util . F ( 'song sw' ) % ( min ( a , b ) , max ( a , b ) ) ) g . content = content . generate_songlist_display ( )
move a song or swap two songs .