from uykfe.sequence.distance.distance import DistanceControl, DistanceState LOG = getLogger(__name__) if __name__ == '__main__': parser = build_weighted_parser('Print a playlist to stdout') add_depth(parser) add_inital_artist(parser) parser.add_argument('count', metavar='N', type=int, help='the number of entries') args = parser.parse_args() set_logging(args.debug) LOG.info('File system encoding {0}'.format(getfilesystemencoding())) LOG.info('Stdout encoding {0}'.format(stdout.encoding)) session = open_db()() track = find_track(session, args.artist, args.track) state = DistanceState(session, args.limit, args.unidirectional) if track: state.record_track(track) control = DistanceControl(state, args.localexp, args.depth, args.depthexp, args.unidirectional, args.neighbour) stdout.buffer.write('#EXTM3U\n'.encode('utf8')) for track in islice(sequence(state, control), args.count): url = track.url if url.startswith('file://'): url = url[len('file://'):] # LOG.info(url) # print(url) stdout.buffer.write((url + '\n').encode('utf8'))
from uykfe.support.db import open_db from uykfe.support.squeeze import SqueezeServer from uykfe.sequence.base import sequence from uykfe.args import build_weighted_parser, add_depth, set_logging from uykfe.sequence.distance.distance import DistanceControl, DistanceState if __name__ == '__main__': parser = build_weighted_parser('Add items to SqueezeCenter playlist as needed') add_depth(parser) parser.add_argument('-c', '--config', default='.uykferc', help='config file') args = parser.parse_args() set_logging(args.debug) squeeze = SqueezeServer(name=args.config) state = DistanceState(open_db()(), args.limit, args.unidirectional, squeeze) control = DistanceControl(state, args.localexp, args.depth, args.depthexp, args.unidirectional, args.neighbour) state.wait() for track in sequence(state, control): squeeze.playlist_add(track.url) state.wait()
from uykfe.support.db import open_db from uykfe.support.squeeze import SqueezeServer from uykfe.sequence.base import sequence from uykfe.args import build_weighted_parser, add_depth, set_logging from uykfe.sequence.distance.distance import DistanceControl, DistanceState if __name__ == '__main__': parser = build_weighted_parser( 'Add items to SqueezeCenter playlist as needed') add_depth(parser) parser.add_argument('-c', '--config', default='.uykferc', help='config file') args = parser.parse_args() set_logging(args.debug) squeeze = SqueezeServer(name=args.config) state = DistanceState(open_db()(), args.limit, args.unidirectional, squeeze) control = DistanceControl(state, args.localexp, args.depth, args.depthexp, args.unidirectional, args.neighbour) state.wait() for track in sequence(state, control): squeeze.playlist_add(track.url) state.wait()