当前位置: 首页>>代码示例>>Java>>正文


Java MusicTrack类代码示例

本文整理汇总了Java中org.fourthline.cling.support.model.item.MusicTrack的典型用法代码示例。如果您正苦于以下问题:Java MusicTrack类的具体用法?Java MusicTrack怎么用?Java MusicTrack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MusicTrack类属于org.fourthline.cling.support.model.item包,在下文中一共展示了MusicTrack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createItem

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
public Item createItem(MediaFile song) throws Exception {
    MediaFile parent = mediaFileService.getParentOf(song);
    MusicTrack item = new MusicTrack();
    item.setId(String.valueOf(song.getId()));
    item.setParentID(String.valueOf(parent.getId()));
    item.setTitle(song.getTitle());
    item.setAlbum(song.getAlbumName());
    if (song.getArtist() != null) {
        item.setArtists(new PersonWithRole[]{new PersonWithRole(song.getArtist())});
    }
    Integer year = song.getYear();
    if (year != null) {
        item.setDate(year + "-01-01");
    }
    item.setOriginalTrackNumber(song.getTrackNumber());
    if (song.getGenre() != null) {
        item.setGenres(new String[]{song.getGenre()});
    }
    item.setResources(Arrays.asList(createResourceForSong(song)));
    item.setDescription(song.getComment());
    item.addProperty(new DIDLObject.Property.UPNP.ALBUM_ART_URI(getAlbumArtUrl(parent.getId())));

    return item;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:25,代码来源:DispatchingContentDirectory.java

示例2: createItem

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
public Item createItem(MediaFile song) throws Exception {
    MediaFile parent = getMediaFileService().getParentOf(song);
    MusicTrack item = new MusicTrack();
    item.setId(String.valueOf(song.getId()));
    item.setParentID(String.valueOf(parent.getId()));
    item.setTitle(song.getTitle());
    item.setAlbum(song.getAlbumName());
    if (song.getArtist() != null) {
        item.setArtists(getDispatcher().getAlbumProcessor().getAlbumArtists(song.getArtist()));
    }
    Integer year = song.getYear();
    if (year != null) {
        item.setDate(year + "-01-01");
    }
    item.setOriginalTrackNumber(song.getTrackNumber());
    if (song.getGenre() != null) {
        item.setGenres(new String[]{song.getGenre()});
    }
    item.setResources(Arrays.asList(getDispatcher().createResourceForSong(song)));
    item.setDescription(song.getComment());
    item.addProperty(new DIDLObject.Property.UPNP.ALBUM_ART_URI(getDispatcher().getAlbumProcessor().getAlbumArtURI(parent.getId())));

    return item;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:25,代码来源:MediaFileUpnpProcessor.java

示例3: createItem

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
private Item createItem(MediaFile song) throws Exception {
    MediaFile parent = mediaFileService.getParentOf(song);
    MusicTrack item = new MusicTrack();
    item.setId(String.valueOf(song.getId()));
    item.setParentID(String.valueOf(parent.getId()));
    item.setTitle(song.getTitle());
    item.setAlbum(song.getAlbumName());
    if (song.getArtist() != null) {
        item.setArtists(new PersonWithRole[]{new PersonWithRole(song.getArtist())});
    }
    Integer year = song.getYear();
    if (year != null) {
        item.setDate(year + "-01-01");
    }
    item.setOriginalTrackNumber(song.getTrackNumber());
    if (song.getGenre() != null) {
        item.setGenres(new String[]{song.getGenre()});
    }
    item.setResources(Arrays.asList(createResourceForSong(song)));
    item.setDescription(song.getComment());
    item.addProperty(new DIDLObject.Property.UPNP.ALBUM_ART_URI(getAlbumArtUrl(parent)));

    return item;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:25,代码来源:FolderBasedContentDirectory.java

示例4: ContentDirectory

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
public ContentDirectory(){
	StorageFolder rootContainer = new StorageFolder("0","-1","Root","yaacc",2,907000l);
	rootContainer.setSearchable(true);
	rootContainer.setRestricted(false);
	content.put(rootContainer.getId(),rootContainer);
	List<MusicTrack> musicTracks = createMusicTracks("1");
	MusicAlbum musicAlbum = new MusicAlbum("1", rootContainer, "Music", "yaacc",musicTracks.size(),musicTracks);
	musicAlbum.setSearchable(true);
	musicAlbum.setRestricted(false);
	rootContainer.addContainer(musicAlbum);
	content.put(musicAlbum.getId(),musicAlbum);
	List<Photo> photos = createPhotos("2"); 
	PhotoAlbum photoAlbum = new PhotoAlbum("2", rootContainer, "Photos", "yaacc", photos.size(),photos);
	photoAlbum.setSearchable(true);
	photoAlbum.setRestricted(false);
	rootContainer.addContainer(photoAlbum);
	content.put(photoAlbum.getId(),photoAlbum);
    	
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:20,代码来源:ContentDirectory.java

示例5: createTestContentDirectory

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
/**
 * 
 */
private void createTestContentDirectory() {
	StorageFolder rootContainer = new StorageFolder("0", "-1", "root",
			"yaacc", 2, 907000L);
	rootContainer.setClazz(new DIDLObject.Class("object.container"));
	rootContainer.setRestricted(true);
	addContent(rootContainer.getId(), rootContainer);
	List<MusicTrack> musicTracks = createMusicTracks("1");
	MusicAlbum musicAlbum = new MusicAlbum("1", rootContainer, "Music",
			null, musicTracks.size(), musicTracks);
	musicAlbum.setClazz(new DIDLObject.Class("object.container"));
	musicAlbum.setRestricted(true);
	rootContainer.addContainer(musicAlbum);
	addContent(musicAlbum.getId(), musicAlbum);
	List<Photo> photos = createPhotos("2");
	PhotoAlbum photoAlbum = new PhotoAlbum("2", rootContainer, "Photos",
			null, photos.size(), photos);
	photoAlbum.setClazz(new DIDLObject.Class("object.container"));
	photoAlbum.setRestricted(true);
	rootContainer.addContainer(photoAlbum);
	addContent(photoAlbum.getId(), photoAlbum);
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:25,代码来源:YaaccContentDirectory.java

示例6: getAudioList

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
public static List<Item> getAudioList(String serverUrl, String parentId) {
    List<Item> items = new ArrayList<>();

    //Query all track,add to items
    Cursor c = BeyondApplication.getApplication().getContentResolver()
            .query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, MediaStore.Audio.Media.TITLE);
    c.moveToFirst();
    while (!c.isAfterLast()) {
        long id = c.getLong(c.getColumnIndex(MediaStore.Audio.Media._ID));
        String title = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE));
        String creator = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST));
        String album = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM));

        String data = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA));
        //Remove SDCard path
        data = data.replaceFirst(storageDir, "");
        //Replace file name by "id.ext"
        String fileName = data.substring(data.lastIndexOf(File.separator));
        String ext = fileName.substring(fileName.lastIndexOf("."));
        data = data.replace(fileName, File.separator + id + ext);

        String mimeType = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.MIME_TYPE));
        long size = c.getLong(c.getColumnIndexOrThrow(MediaStore.Audio.Media.SIZE));
        long duration = c.getLong(c.getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION));
        //Get duration string
        String durationStr = ModelUtil.toTimeString(duration);

        //Compose audio url
        String url = serverUrl + File.separator + "audio" + File.separator + data;
        Res res = new Res(mimeType, size, durationStr, null, url);

        items.add(new MusicTrack(String.valueOf(id), parentId, title, creator, album, new PersonWithRole(creator), res));

        c.moveToNext();
    }

    return items;
}
 
开发者ID:kevinshine,项目名称:BeyondUPnP,代码行数:39,代码来源:MediaResourceDao.java

示例7: getMusicTracks

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
public MusicTrack[] getMusicTracks() {
    List<MusicTrack> list = new ArrayList();
    for (Item item : getItems()) {
        if (item instanceof MusicTrack) list.add((MusicTrack)item);
    }
    return list.toArray(new MusicTrack[list.size()]);
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:MusicAlbum.java

示例8: addMusicTracks

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
public void addMusicTracks(MusicTrack[] musicTracks) {
    if (musicTracks != null) {
        for (MusicTrack musicTrack : musicTracks) {
            musicTrack.setAlbum(getTitle());
            addItem(musicTrack);
        }
    }
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:9,代码来源:MusicAlbum.java

示例9: getDescription

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
@Override
public String getDescription()
{
	if(item instanceof MusicTrack)
	{
		MusicTrack track = (MusicTrack) item;
		return ( (track.getFirstArtist()!=null && track.getFirstArtist().getName()!=null) ? track.getFirstArtist().getName() : "") +
			((track.getAlbum()!=null) ?  (" - " + track.getAlbum()) : "");
	}
	return ((AudioItem) item).getDescription();
}
 
开发者ID:trishika,项目名称:DroidUPnP,代码行数:12,代码来源:ClingAudioItem.java

示例10: browseMeta

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
@Override
public DIDLObject browseMeta(YaaccContentDirectory contentDirectory,
                             String myId) {
    Item result = null;
    String[] projection = {MediaStore.Audio.Media._ID,
            MediaStore.Audio.Media.DISPLAY_NAME,
            MediaStore.Audio.Media.MIME_TYPE, MediaStore.Audio.Media.SIZE,
            MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.ALBUM_ID,
            MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.ARTIST,
            MediaStore.Audio.Media.DURATION};
    String selection = MediaStore.Audio.Media._ID + "=?";
    String[] selectionArgs = new String[]{myId
            .substring(ContentDirectoryIDs.MUSIC_ALL_TITLES_ITEM_PREFIX
                    .getId().length())};
    Cursor mediaCursor = contentDirectory
            .getContext()
            .getContentResolver()
            .query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection,
                    selection, selectionArgs, null);

    if (mediaCursor != null) {
        mediaCursor.moveToFirst();
        String id = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media._ID));
        String name = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
        Long size = Long.valueOf(mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.SIZE)));

        String album = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.ALBUM));
        String albumId = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.ALBUM_ID));
        String title = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.TITLE));
        String artist = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.ARTIST));
        String duration = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.DURATION));
        duration = contentDirectory.formatDuration(duration);
        Log.d(getClass().getName(),
                "Mimetype: "
                        + mediaCursor.getString(mediaCursor
                        .getColumnIndex(MediaStore.Audio.Media.MIME_TYPE)));

        MimeType mimeType = MimeType.valueOf(mediaCursor
                .getString(mediaCursor
                        .getColumnIndex(MediaStore.Audio.Media.MIME_TYPE)));
        // file parameter only needed for media players which decide
        // the
        // ability of playing a file by the file extension

        String uri = getUriString(contentDirectory, id, mimeType);
        URI albumArtUri = URI.create("http://"
                + contentDirectory.getIpAddress() + ":"
                + YaaccUpnpServerService.PORT + "/?album=" + albumId);
        Res resource = new Res(mimeType, size, uri);
        resource.setDuration(duration);
        MusicTrack musicTrack = new MusicTrack(
                ContentDirectoryIDs.MUSIC_ALL_TITLES_ITEM_PREFIX.getId()
                        + id,
                ContentDirectoryIDs.MUSIC_ALL_TITLES_FOLDER.getId(), title
                + "-(" + name + ")", "", album, artist, resource);
        musicTrack
                .replaceFirstProperty(new UPNP.ALBUM_ART_URI(albumArtUri));
        result = musicTrack;
        Log.d(getClass().getName(), "MusicTrack: " + id + " Name: " + name
                + " uri: " + uri);

        mediaCursor.close();
    } else {
        Log.d(getClass().getName(), "Item " + myId + "  not found.");
    }

    return result;
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:77,代码来源:MusicAllTitleItemBrowser.java

示例11: browseMeta

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
@Override
public DIDLObject browseMeta(YaaccContentDirectory contentDirectory,
		String myId) {
	Item result = null;
	String[] projection = { MediaStore.Audio.Media._ID,
			MediaStore.Audio.Media.DISPLAY_NAME,
			MediaStore.Audio.Media.MIME_TYPE, MediaStore.Audio.Media.SIZE,
			MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.ALBUM_ID,
			MediaStore.Audio.Media.ARTIST_ID, MediaStore.Audio.Media.TITLE,
			MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.DURATION };
	String selection = MediaStore.Audio.Media._ID + "=?";
	String[] selectionArgs = new String[] { myId
			.substring(ContentDirectoryIDs.MUSIC_ARTIST_ITEM_PREFIX.getId()
					.length()) };
	Cursor mediaCursor = contentDirectory
			.getContext()
			.getContentResolver()
			.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection,
					selection, selectionArgs, null);

	if (mediaCursor != null) {
		mediaCursor.moveToFirst();
		String id = mediaCursor.getString(mediaCursor
				.getColumnIndex(MediaStore.Audio.Media._ID));
		String name = mediaCursor.getString(mediaCursor
				.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
		Long size = Long.valueOf(mediaCursor.getString(mediaCursor
				.getColumnIndex(MediaStore.Audio.Media.SIZE)));

		String album = mediaCursor.getString(mediaCursor
				.getColumnIndex(MediaStore.Audio.Media.ALBUM));
		String albumId = mediaCursor.getString(mediaCursor
				.getColumnIndex(MediaStore.Audio.Media.ALBUM));
		String artistId = mediaCursor.getString(mediaCursor
				.getColumnIndex(MediaStore.Audio.Media.ARTIST_ID));
		String title = mediaCursor.getString(mediaCursor
				.getColumnIndex(MediaStore.Audio.Media.TITLE));
		String artist = mediaCursor.getString(mediaCursor
				.getColumnIndex(MediaStore.Audio.Media.ARTIST));
		String duration = mediaCursor.getString(mediaCursor
				.getColumnIndex(MediaStore.Audio.Media.DURATION));
		duration = contentDirectory.formatDuration(duration);
		Log.d(getClass().getName(),
				"Mimetype: "
						+ mediaCursor.getString(mediaCursor
								.getColumnIndex(MediaStore.Audio.Media.MIME_TYPE)));

		MimeType mimeType = MimeType.valueOf(mediaCursor
				.getString(mediaCursor
						.getColumnIndex(MediaStore.Audio.Media.MIME_TYPE)));
		// file parameter only needed for media players which decide
		// the
		// ability of playing a file by the file extension

           String uri = getUriString(contentDirectory, id, mimeType);
		URI albumArtUri = URI.create("http://"
				+ contentDirectory.getIpAddress() + ":"
				+ YaaccUpnpServerService.PORT + "/?album=" + albumId);
		Res resource = new Res(mimeType, size, uri);
		resource.setDuration(duration);
		MusicTrack musicTrack = new MusicTrack(
				ContentDirectoryIDs.MUSIC_ARTIST_ITEM_PREFIX.getId() + id,
				ContentDirectoryIDs.MUSIC_ARTIST_PREFIX.getId() + artistId,
				title + "-(" + name + ")", "", album, artist, resource);
		musicTrack
				.replaceFirstProperty(new UPNP.ALBUM_ART_URI(albumArtUri));
		result = musicTrack;
		Log.d(getClass().getName(), "MusicTrack: " + id + " Name: " + name
				+ " uri: " + uri);

		mediaCursor.close();
	} else {
		Log.d(getClass().getName(), "Item " + myId + "  not found.");
	}

	return result;
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:78,代码来源:MusicArtistItemBrowser.java

示例12: browseMeta

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
@Override
public DIDLObject browseMeta(YaaccContentDirectory contentDirectory,
                             String myId) {
    Item result = null;
    String[] projection = {MediaStore.Audio.Media._ID,
            MediaStore.Audio.Media.DISPLAY_NAME,
            MediaStore.Audio.Media.MIME_TYPE, MediaStore.Audio.Media.SIZE,
            MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.ALBUM_ID,
            MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.ARTIST,
            MediaStore.Audio.Media.DURATION};
    String selection = MediaStore.Audio.Media._ID + "=?";
    String[] selectionArgs = new String[]{myId
            .substring(ContentDirectoryIDs.MUSIC_ALBUM_ITEM_PREFIX.getId()
                    .length())};
    Cursor mediaCursor = contentDirectory
            .getContext()
            .getContentResolver()
            .query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection,
                    selection, selectionArgs, MediaStore.Audio.Media.DISPLAY_NAME + " ASC");

    if (mediaCursor != null) {
        mediaCursor.moveToFirst();
        String id = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media._ID));
        String name = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
        Long size = Long.valueOf(mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.SIZE)));

        String album = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.ALBUM));
        String albumId = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.ALBUM_ID));
        String title = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.TITLE));
        String artist = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.ARTIST));
        String duration = mediaCursor.getString(mediaCursor
                .getColumnIndex(MediaStore.Audio.Media.DURATION));
        duration = contentDirectory.formatDuration(duration);
        Log.d(getClass().getName(),
                "Mimetype: "
                        + mediaCursor.getString(mediaCursor
                        .getColumnIndex(MediaStore.Audio.Media.MIME_TYPE)));

        MimeType mimeType = MimeType.valueOf(mediaCursor
                .getString(mediaCursor
                        .getColumnIndex(MediaStore.Audio.Media.MIME_TYPE)));
        // file parameter only needed for media players which decide
        // the
        // ability of playing a file by the file extension

        String uri = getUriString(contentDirectory, id, mimeType);
        URI albumArtUri = URI.create("http://"
                + contentDirectory.getIpAddress() + ":"
                + YaaccUpnpServerService.PORT + "/?album=" + albumId);
        Res resource = new Res(mimeType, size, uri);
        resource.setDuration(duration);
        MusicTrack musicTrack = new MusicTrack(
                ContentDirectoryIDs.MUSIC_ALBUM_ITEM_PREFIX.getId() + id,
                ContentDirectoryIDs.MUSIC_ALBUM_PREFIX.getId() + albumId,
                title + "-(" + name + ")", "", album, artist, resource);
        musicTrack
                .replaceFirstProperty(new UPNP.ALBUM_ART_URI(albumArtUri));
        result = musicTrack;
        Log.d(getClass().getName(), "MusicTrack: " + id + " Name: " + name
                + " uri: " + uri);

        mediaCursor.close();
    } else {
        Log.d(getClass().getName(), "Item " + myId + "  not found.");
    }

    return result;
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:76,代码来源:MusicAlbumItemBrowser.java

示例13: addAudioContent

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
/**
     * 添加音频
     */
    private void addAudioContent(Context context, ContentNode rootNode) {

        Container audioContainer = new Container(ContentTree.AUDIO_ID,
                ContentTree.ROOT_ID, "Audios", "HPlayer MediaServer",
                new DIDLObject.Class("object.container"), 0);
        audioContainer.setRestricted(true);
        audioContainer.setWriteStatus(WriteStatus.NOT_WRITABLE);

        rootNode.getContainer().addContainer(audioContainer);
        rootNode.getContainer().setChildCount(
                rootNode.getContainer().getChildCount() + 1);
        ContentTree.addNode(ContentTree.AUDIO_ID, new ContentNode(
                ContentTree.AUDIO_ID, audioContainer));

        Cursor cursor = context.getContentResolver()
                .query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
                        null, null, null, null);
        if (cursor == null) {
            return;
        }

        while (cursor.moveToNext()) {
            String id = ContentTree.AUDIO_PREFIX
                    + cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Media._ID));
            String title = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE));
            String creator = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST));
            String filePath = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.DATA));
            String mimeType = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.MIME_TYPE));
            long size = cursor.getLong(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.SIZE));
            long duration = cursor.getLong(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION));
            String album = cursor.getString(cursor
                    .getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM));
            Res res = new Res(new MimeType(mimeType.substring(0, mimeType.indexOf('/')),
                    mimeType.substring(mimeType.indexOf('/') + 1)), size,
                    "http://" + address + "/" + id);
            res.setDuration(duration / (1000 * 60 * 60) + ":"
                    + (duration % (1000 * 60 * 60)) / (1000 * 60) + ":"
                    + (duration % (1000 * 60)) / 1000);

            // Music Track must have `artist' with role field, or
            // DIDLParser().generate(didl) will throw nullpointException
            MusicTrack musicTrack = new MusicTrack(id,
                    ContentTree.AUDIO_ID, title, creator, album,
                    new PersonWithRole(creator, "Performer"), res);
            audioContainer.addItem(musicTrack);
            audioContainer.setChildCount(audioContainer.getChildCount() + 1);
            ContentTree.addNode(id, new ContentNode(id, musicTrack, filePath));

//            Log.d(TAG, "added audio item " + title + "from " + filePath);
        }

        cursor.close();
    }
 
开发者ID:hezhubo,项目名称:HPlayer,代码行数:63,代码来源:GenerateContentTask.java

示例14: replaceGenericItems

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
protected List<Item> replaceGenericItems(List<Item> genericItems) {
    List<Item> specificItems = new ArrayList();

    for (Item genericItem : genericItems) {
        String genericType = genericItem.getClazz().getValue();

        if (AudioItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new AudioItem(genericItem));
        } else if (MusicTrack.CLASS.getValue().equals(genericType)) {
            specificItems.add(new MusicTrack(genericItem));
        } else if (AudioBook.CLASS.getValue().equals(genericType)) {
            specificItems.add(new AudioBook(genericItem));
        } else if (AudioBroadcast.CLASS.getValue().equals(genericType)) {
            specificItems.add(new AudioBroadcast(genericItem));

        } else if (VideoItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new VideoItem(genericItem));
        } else if (Movie.CLASS.getValue().equals(genericType)) {
            specificItems.add(new Movie(genericItem));
        } else if (VideoBroadcast.CLASS.getValue().equals(genericType)) {
            specificItems.add(new VideoBroadcast(genericItem));
        } else if (MusicVideoClip.CLASS.getValue().equals(genericType)) {
            specificItems.add(new MusicVideoClip(genericItem));

        } else if (ImageItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new ImageItem(genericItem));
        } else if (Photo.CLASS.getValue().equals(genericType)) {
            specificItems.add(new Photo(genericItem));

        } else if (PlaylistItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new PlaylistItem(genericItem));

        } else if (TextItem.CLASS.getValue().equals(genericType)) {
            specificItems.add(new TextItem(genericItem));

        } else {
            specificItems.add(genericItem);
        }
    }

    return specificItems;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:43,代码来源:DIDLContent.java

示例15: MusicAlbum

import org.fourthline.cling.support.model.item.MusicTrack; //导入依赖的package包/类
public MusicAlbum(String id, Container parent, String title, String creator, Integer childCount) {
    this(id, parent.getId(), title, creator, childCount, new ArrayList<MusicTrack>());
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:4,代码来源:MusicAlbum.java


注:本文中的org.fourthline.cling.support.model.item.MusicTrack类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。