DictListResult Collection::queryInfos( const Coll::Coll& coll, const std::list< std::string >& fetch, const std::list< std::string >& order, int limit_len, int limit_start, const std::list< std::string >& group ) const { assertNonEmptyFetchList( fetch ); xmmsv_t *xorder, *xfetch, *xgroup; xorder = makeStringList( order ); xfetch = makeStringList( fetch ); xgroup = makeStringList( group ); xmmsc_result_t* res = call( connected_, boost::bind( xmmsc_coll_query_infos, conn_, coll.coll_, xorder, limit_start, limit_len, xfetch, xgroup ) ); xmmsv_unref( xorder ); xmmsv_unref( xfetch ); xmmsv_unref( xgroup ); return DictListResult( res, ml_ ); }
void openCst(char *filename, char *output) //CST files are strings with an offset index compressed using zlib. { int fd; unsigned long compressedLen, decompressedLen, *offsetList = NULL, j, tempStorage, indexOffset, baseOffset; unsigned int i; char magic[9], **stringList = NULL; unsigned char *compressedBuff = NULL, *decompressedBuff = NULL; fd = open(filename, O_RDONLY | O_BINARY); magic[8] = 0; read(fd, &magic, 8); if(strcmp(magic, "CatScene")) { printf("Invalid cst file, magic does not match.\nExpecting CatScene, was %s", magic); return; } read(fd, &compressedLen, 4); read(fd, &decompressedLen, 4); compressedBuff = malloc(compressedLen); decompressedBuff = malloc(decompressedLen); read(fd, compressedBuff, compressedLen); j = decompressedLen; i = uncompress(decompressedBuff, &decompressedLen, compressedBuff, compressedLen); if(i != Z_OK) { printf("Error: decompression error (%d)", i); return; } if(decompressedLen != j) { printf("Error: decompression error.\nExpected decompressed size: %lu\nActual decompressed size: %lu\n", j, decompressedLen); return; } memcpy(&tempStorage, (decompressedBuff + 8), 4); indexOffset = 0x10 + tempStorage; memcpy(&tempStorage, (decompressedBuff + 12), 4); baseOffset = 0x10 + tempStorage; offsetList = makeOffsetList(decompressedBuff, indexOffset, baseOffset); stringList = makeStringList(decompressedBuff, offsetList); close(fd); fd = open(output, O_WRONLY | O_TRUNC | O_CREAT); for(i = 0; stringList; i++) write(fd, stringList[i], strlen(stringList[i])); close(fd); free(compressedBuff); free(decompressedBuff); free(offsetList); free(stringList); }
VoidResult Playlist::sort( const std::list<std::string>& properties, const std::string& playlist ) const { xmmsv_t *xprops = makeStringList( properties ); xmmsc_result_t* res = call( connected_, boost::bind( xmmsc_playlist_sort, conn_, playlist.c_str(), xprops ) ); xmmsv_unref( xprops ); return VoidResult( res, ml_ ); }
VoidResult Playlist::insertCollection( int pos, const Coll::Coll& collection, const std::list< std::string >& order, const std::string& playlist ) const { xmmsv_t *xorder = makeStringList( order ); xmmsc_result_t* res = call( connected_, boost::bind( xmmsc_playlist_insert_collection, conn_, playlist.c_str(), pos, collection.getColl(), xorder ) ); xmmsv_unref( xorder ); return VoidResult( res, ml_ ); }
IntListResult Collection::queryIds( const Coll::Coll& coll, const std::list< std::string >& order, int limit_len, int limit_start ) const { xmmsv_t *xorder = makeStringList( order ); xmmsc_result_t* res = call( connected_, boost::bind( xmmsc_coll_query_ids, conn_, coll.coll_, xorder, limit_start, limit_len ) ); xmmsv_unref( xorder ); return IntListResult( res, ml_ ); }