Пример #1
0
    public static string GetCoverArt(bool isfolder, string filename, MusicTag tag)
    {
      string strAlbumName = string.Empty;
      string strArtistName = string.Empty;
      if (tag != null)
      {
        if (!string.IsNullOrEmpty(tag.Album))
        {
          strAlbumName = tag.Album;
        }
        if (!string.IsNullOrEmpty(tag.Artist))
        {
          strArtistName = tag.Artist;
        }
      }

      // attempt to pick up album thumb if already scanned 
      string strThumb = Util.Utils.GetAlbumThumbName(strArtistName, strAlbumName);
      if (Util.Utils.FileExistsInCache(strThumb))
      {
        if (_createMissingFolderThumbs && _createMissingFolderThumbCache)
        {
          string folderThumb = Util.Utils.GetFolderThumb(filename);
          if (!Util.Utils.FileExistsInCache(folderThumb))
          {
            FolderThumbCreator thumbCreator = new FolderThumbCreator(filename, tag);
          }
        }
        return strThumb;
      }

      // attempt to load folder.jpg
      if (!Util.Utils.IsAVStream(filename))
      {
        string strFolderThumb = string.Empty;
        if (isfolder)
        {
          strFolderThumb = Util.Utils.GetLocalFolderThumbForDir(filename);
        }
        else
        {
          strFolderThumb = Util.Utils.GetLocalFolderThumb(filename);
        }

        if (Util.Utils.FileExistsInCache(strFolderThumb))
        {
          return strFolderThumb;
        }
        else
        {
          if (_createMissingFolderThumbCache)
          {
            FolderThumbCacher thumbworker = new FolderThumbCacher(filename, false);
          }
        }
      }

      //TODO: consider lookup of embedded artwork

      return string.Empty;
    }
Пример #2
0
    /// <summary>
    /// Returns the name of the Cover Art file from the Thumbs folder
    /// </summary>
    /// <param name="isfolder">Indicator, if we are on a folder</param>
    /// <param name="filename">The Song Filename</param>
    /// <param name="tag">THe Music Tag</param>
    /// <returns>String with the name of the Cover Art file to be used</returns>
    private static string GetThumbsFolderCoverArt(bool isfolder, string filename, MusicTag tag)
    {
      if (tag != null && !isfolder)
      {
        var strAlbumName = string.Empty;
        var strArtistName = string.Empty;
        if (!string.IsNullOrEmpty(tag.Album))
        {
          strAlbumName = tag.Album;
        }
        if (!string.IsNullOrEmpty(tag.Artist))
        {
          strArtistName = tag.Artist;
        }

        // attempt to pick up album thumb if already scanned 
        var strThumb = Util.Utils.GetAlbumThumbName(strArtistName, strAlbumName);
        if (Util.Utils.FileExistsInCache(strThumb))
        {
          if (_createMissingFolderThumbs && _createMissingFolderThumbCache)
          {
            string folderThumb = Util.Utils.GetFolderThumb(filename);
            if (!Util.Utils.FileExistsInCache(folderThumb))
            {
              var thumbCreator = new FolderThumbCreator(filename, tag);
            }
          }
          return strThumb;
        }
      }
      return string.Empty;
    }