package org.arkiwi.app.utility;

import java.util.HashMap;
import java.util.Iterator;

import org.arkiwi.app.feed.FeedItem;
import org.arkiwi.app.feed.FeedItemFile;
import org.arkiwi.app.feed.FeedQuery;

import android.util.Log;

public class ALog {
	public static void logFeed(String LOG_TAG, FeedQuery q) {
		Log.i(LOG_TAG, "logFeed()");
		Log.d(LOG_TAG, "qid:" + q.getQid());
		Log.d(LOG_TAG, "title:" + q.getTitle());
		Log.d(LOG_TAG, "desc:" + q.getDesc());
		Log.d(LOG_TAG, "last:" + q.getLast());
		Log.d(LOG_TAG, "refresh:" + q.getRefresh());
		Log.d(LOG_TAG, "link:" + q.getLink());
		Log.d(LOG_TAG, "status:" + q.getStatus());

		HashMap<String, FeedItem> feeds = q.getFeedItems();
		Iterator<String> iterator = feeds.keySet().iterator();
		while (iterator.hasNext()) {
			String key = (String) iterator.next();
			FeedItem i = q.getFeedItem(key);
			String type = i.getMediaType();
			Log.d(LOG_TAG, "iid:" + i.getIid());
			Log.d(LOG_TAG, "title:" + i.getTitle());
			Log.d(LOG_TAG, "desc:" + i.getDescriprion());
			Log.d(LOG_TAG, "guid:" + i.getGuid());
			Log.d(LOG_TAG, "link:" + i.getLink());
			Log.d(LOG_TAG, "pdate:" + i.getPubDate());
			Log.d(LOG_TAG, "qrcode:" + i.getQrcode());
			Log.d(LOG_TAG, "status:" + i.getStatus());
			Log.d(LOG_TAG, "mediaType:" + i.getMediaType());
			if (type != "dir") {
				Log.d(LOG_TAG, ":" + i.getIid());
				Log.d(LOG_TAG, "channel:" + ((FeedItemFile) i).getChannels());
				Log.d(LOG_TAG, "creator:" + ((FeedItemFile) i).getCreator());
				Log.d(LOG_TAG, "download:" + ((FeedItemFile) i).getDownload());
				Log.d(LOG_TAG, "duration:" + ((FeedItemFile) i).getDuration());
				Log.d(LOG_TAG, "size:" + ((FeedItemFile) i).getSize());
				Log.d(LOG_TAG, "rate:" + ((FeedItemFile) i).getRate());
				Log.d(LOG_TAG, "torrent:" + ((FeedItemFile) i).getTorrent());
				Log.d(LOG_TAG, "tags:" + ((FeedItemFile) i).getTags());
			}
		}
	}

}
