public static TagOption SetSelected(this TagOption tag, bool check) { if (check) { tag.Selected("selected"); } return(tag); }
public override SongTagFile PopulateSongTag(string fileName, TagOption options = TagOption.All) { //Can we scan discogs var discogOption = options.HasFlag(TagOption.Discog); //var tagged = Tagger.GetMp3Tag(fileName); return(CreateSongModelWithTagLib(fileName)); }
/// <summary> /// Gets the tag information from a file"/> /// </summary> /// <param name="fileName">Name of the file.</param> /// <param name="options">The options.</param> /// <returns></returns> public SongTagFile GetTagInformation(string fileName, TagOption options = TagOption.All) { if (Path.GetExtension(fileName).ToUpper() == ".FLAC") { return(_songTaggerTagLib.PopulateSongTag(fileName, options)); } return(_songTagger.PopulateSongTag(fileName, options)); }
/// <summary> /// Constructor for ClanTag /// </summary> public ClanTag(string tag, IEnumerable <Source> sources, TagOption tagOption = TagOption.Unknown) : base(tag, sources) { LayoutOption = tagOption; if (tagOption == TagOption.Surrounding && tag.Length == 2 && tag[0] == tag[1]) { Value = tag[0].ToString(); } }
public override SongTagFile PopulateSongTag(string fileName, TagOption tagOption = TagOption.All) { using (var fileStream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite)) using (Mp3Stream mp3Stream = new Mp3Stream(fileStream, Mp3Permissions.ReadWrite)) { var id3Tag = GetTagFromStream(mp3Stream); if (id3Tag != null) { var song = new SongTagFile(); song.Duration = mp3Stream.Audio.Duration.ToString(); song.BitRate = mp3Stream.Audio.Bitrate; return(CreateSongTag(song, id3Tag, tagOption)); } } return(null); }
/// <summary> /// Parses Id3 to create a song model /// </summary> /// <param name="songFile">song file path</param> /// <returns>new song</returns> private SongTagFile CreateSongTag(SongTagFile song, Id3Tag tag, TagOption options = TagOption.All) { //If that tag returned null return if (tag == null) { return(song); } GetTrackNumber(song, tag); GetArtist(song, tag); GetTitle(song, tag); GetAlbum(song, tag); GetYear(song, tag); GetRating(song, tag); GetBpm(song, tag); GetGenre(song, tag); GetComments(song, tag); GetMusicalKey(song, tag); //ARTWORK if (options.HasFlag(TagOption.All) || options.HasFlag(TagOption.Artwork)) { GetPictureBytes(song, tag); } //Country if (options.HasFlag(TagOption.All) || options.HasFlag(TagOption.Country)) { song.Country = GetCountry(tag); } //DISCOGS if (options.HasFlag(TagOption.All) || options.HasFlag(TagOption.Discog)) { GetDiscogsId(song, tag); } //LABEL if (options.HasFlag(TagOption.All) || options.HasFlag(TagOption.Label)) { GetLabelPublisher(song, tag); } return(song); }
private async Task <IEnumerable <DocumentGroup> > GetDocumentsToCreate(TagOption option, IEnumerable <TagElement> tags) { switch (option) { case TagOption.ReplaceTags: return(this.ReplaceTags(tags)); case TagOption.LoadReplacedTags: IEnumerable <DocumentGroup>?loadedTags = await TaskExecutable.RunTask(this.LoadReplacedTags); if (loadedTags == null) { return(Enumerable.Empty <DocumentGroup>()); } return(loadedTags); } return(Enumerable.Empty <DocumentGroup>()); }
public static TagOption onkeypress(this TagOption tag, string value) { tag.OnKeyPress = value; return(tag); }
public static TagOption onmouseout(this TagOption tag, string value) { tag.OnMouseOut = value; return(tag); }
public static TagOption ondblclick(this TagOption tag, string value) { tag.OnDblClick = value; return(tag); }
public static TagOption onmousedown(this TagOption tag, string value) { tag.OnMouseDown = value; return(tag); }
public static TagOption onmouseup(this TagOption tag, string value) { tag.OnMouseUp = value; return(tag); }
public static TagOption selected(this TagOption tag, Selected value) { tag.Selected = value; return(tag); }
public virtual SongTagFile PopulateSongTag(string fileName, TagOption options = TagOption.All) { throw new NotImplementedException(); }
public async Task <Dictionary <string, string> > UpdateAllTags(IEnumerable <Horsesoft.Music.Data.Model.File> files, TagOption tagOption = TagOption.All) { _cts = new CancellationTokenSource(); //Make sure Directories exist for artwork CreateArtworkDirectories(); return(await Task.Run(() => { int i = 0; var failedFiles = new Dictionary <string, string>(); foreach (var file in files) { try { if (_cts.IsCancellationRequested) { throw new OperationCanceledException(); } try { //Get tag and save to Db, Add to failed here. var taggedSong = GetTagInformation(file, tagOption); //Create an image SaveImageFromTag(taggedSong); if (taggedSong != null) { //Save image _horsifyDataRepo.UpdateDbSongTag(taggedSong, (int)file.Id); OnTagUpdated?.Invoke($"Tag update: {taggedSong.Title}"); if (i > 250) { i = -1; ((IUnitOfWork)_horsifyDataRepo).Save(); } else { i++; } } } catch (System.Exception ex) { failedFiles.Add(file.ToString(), ex.Message); } } catch (OperationCanceledException) { break; } } ((IUnitOfWork)_horsifyDataRepo).Save(); return failedFiles; }, _cts.Token)); }
public static TagOption id(this TagOption tag, string value) { tag.Id = value; return(tag); }
public static TagOption @class(this TagOption tag, string value) { tag.Class = value; return(tag); }
public static TagOption value(this TagOption tag, string value) { tag.Value = value; return(tag); }
public static TagOption label(this TagOption tag, string value) { tag.Label = value; return(tag); }
public static TagOption disabled(this TagOption tag, Disabled value) { tag.Disabled = value; return(tag); }
public SongTagFile GetTagInformation(Data.Model.File file, TagOption options = TagOption.All) { var songTag = GetTagInformation(file.ToString(), options); return(songTag); }
public static TagOption onkeydown(this TagOption tag, string value) { tag.OnKeyDown = value; return(tag); }
public static TagOption onmousemove(this TagOption tag, string value) { tag.OnMouseMove = value; return(tag); }
public static TagOption xmllang(this TagOption tag, string value) { tag.XmlLang = value; return(tag); }
public static bool Matches(TagOption start, TagOption end) { return(start.Position == TagOptionPosition.start && end.Position == TagOptionPosition.end && start.MainOption == end.MainOption); }
public static TagOption dir(this TagOption tag, Dir value) { tag.Dir = value; return(tag); }
public static TagOption title(this TagOption tag, string value) { tag.Title = value; return(tag); }
public static TagOption onkeyup(this TagOption tag, string value) { tag.OnKeyUp = value; return(tag); }
public static TagOption lang(this TagOption tag, LangCode value) { tag.Lang = value; return(tag); }
/// <summary> /// Construct a ClanTag based on the tag and the source /// </summary> /// <param name="tag"></param> /// <param name="source"></param> public ClanTag(string tag, Source source, TagOption tagOption = TagOption.Unknown) : this(tag, source.AsEnumerable(), tagOption) { }