public void Reload() { _title.Text = _sheet.title(); _performer.Text = _sheet.performer(); _composer.Text = _sheet.composer(); _year.Text = _sheet.year(); _subtitle.Text = _sheet.subtitle(); try { _imagefile.SelectFilename(_sheet.imageFullFileName()); Gdk.Pixbuf pb = new Gdk.Pixbuf(_sheet.imageFullFileName(), 100, 100); _image.Pixbuf = pb; } catch (System.Exception e) { Hyena.Log.Information(e.ToString()); } _store.Clear(); int i, N; for (i = 0, N = _sheet.nEntries(); i < N; i++) { double b = _sheet.entry(i).offset(); int m, s, hs, t; t = (int)(b * 100.0); hs = t % 100; m = t / (100 * 60); s = (t / 100) % 60; String offset = String.Format("{0:00}", m) + ":" + String.Format("{0:00}", s) + "." + String.Format("{0:00}", hs); _store.AppendValues(i + 1, _sheet.entry(i).title(), _sheet.entry(i).performer(), _sheet.entry(i).getComposer(), _sheet.entry(i).getPiece(), offset); } }
private void setLatinTag(int track, CueSheet s, CueSheetEntry e) { string fn = _file_format; fn = fn.Replace("@A", s.performer()); fn = fn.Replace("@b", s.title()); fn = fn.Replace("@n", (track + 1).ToString()); fn = fn.Replace("@t", e.title()); fn = _directory + "/" + fn + ".mp3"; Hyena.Log.Information("file to convert:" + fn); if (File.Exists(fn)) { TagLib.File file = TagLib.File.Create(fn); if (file == null) { Hyena.Log.Error("Cannot create taglib file for " + fn); return; } else { Hyena.Log.Information("Setting tags for " + fn); file.Tag.Album = s.title(); file.Tag.AlbumArtists = new string[] { s.performer() }; file.Tag.Composers = new string[] { s.composer() }; file.Tag.Genres = new string[] { s.genre() }; file.Tag.Title = e.title(); file.Tag.Track = (uint)track + 1; file.Tag.Performers = new string[] { e.performer() }; file.Save(); } } }
public CS_ComposerInfo(CueSheet s) { _sheet = s; if (s != null) { Name = s.composer(); } else { Name = "<All Composers>"; } }
//private Stack<DatabaseTrackInfo> stk=new Stack<DatabaseTrackInfo>(); public void ImportSheet(CueSheet s) { if (import_manager==null) { try { import_manager = new LibraryImportManager (false); /*import_manager.ImportResult+=delegate(object sender,DatabaseImportResultArgs args) { DatabaseTrackInfo trk=args.Track; stk.Push (trk); };*/ } catch (Exception ex) { Hyena.Log.Error (ex.ToString ()); } } Hyena.Log.Debug ("Importsheet: Starting transaction"); int i,N; for(i=0,N=s.nEntries ();i<N;i++) { try { CueSheetEntry e=s.entry (i); string file=e.file (); string uuid=Regex.Replace(e.id (),"\\s","_"); string ext=".mp3"; string uid=Guid.NewGuid ().ToString (); string u1=uid.Substring (0,1); string u2=uid.Substring (0,2); string dir=basedir+"/.banshee/"+u1; if (!Directory.Exists (dir)) { Directory.CreateDirectory(dir); } dir+="/"+u2; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } uuid=dir+"/"+uuid+ext; UnixFileInfo f=new UnixFileInfo(file); if (File.Exists (uuid)) { File.Delete(uuid); } //f.CreateLink (uuid); f.CreateSymbolicLink(uuid); DatabaseTrackInfo trk=import_manager.ImportTrack(uuid); //File.Delete (uuid); /*if (trk==null) { Hyena.Log.Warning ("track = null (file="+e.file ()+")"); if (stk.Count>0) { trk=stk.Pop (); } }*/ if (trk==null) { Hyena.Log.Error ("track = null (file="+e.file ()+")"); } else { Hyena.Log.Information ("track!=null (file="+e.file ()+")"); //MySource.DbConnection.BeginTransaction(); trk.PartOfCue=1; trk.CueAudioFile=e.file (); trk.AlbumTitle=s.title (); //trk.Album=s.title (); trk.AlbumArtist=s.performer (); trk.Composer=(e.Composer=="") ? s.composer () : e.Composer; //trk.ArtworkId=s.getArtId (); //trk.Artist= trk.ArtistName=(e.performer ()=="") ? s.performer () : e.performer (); trk.TrackTitle=e.title (); trk.TrackNumber=i+1; trk.Genre=s.genre (); trk.BeginOffset=e.BeginOffset; trk.EndOffset=e.EndOffset; //trk.Uri=trk.CueAudioUri; //trk.MediaAttributes = TrackMediaAttributes.ExternalResource; //trk.PrimarySource = ServiceManager.SourceManager.MusicLibrary; trk.Save (); //MySource.DbConnection.CommitTransaction(); } } catch (Exception ex) { Hyena.Log.Error (ex.ToString ()); } } import_manager.NotifyAllSources (); }
//private Stack<DatabaseTrackInfo> stk=new Stack<DatabaseTrackInfo>(); public void ImportSheet(CueSheet s) { if (import_manager == null) { try { import_manager = new LibraryImportManager(false); /*import_manager.ImportResult+=delegate(object sender,DatabaseImportResultArgs args) { * DatabaseTrackInfo trk=args.Track; * stk.Push (trk); * };*/ } catch (Exception ex) { Hyena.Log.Error(ex.ToString()); } } Hyena.Log.Debug("Importsheet: Starting transaction"); int i, N; for (i = 0, N = s.nEntries(); i < N; i++) { try { CueSheetEntry e = s.entry(i); string file = e.file(); string uuid = Regex.Replace(e.id(), "\\s", "_"); string ext = ".mp3"; string uid = Guid.NewGuid().ToString(); string u1 = uid.Substring(0, 1); string u2 = uid.Substring(0, 2); string dir = basedir + "/.banshee/" + u1; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } dir += "/" + u2; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } uuid = dir + "/" + uuid + ext; UnixFileInfo f = new UnixFileInfo(file); if (File.Exists(uuid)) { File.Delete(uuid); } //f.CreateLink (uuid); f.CreateSymbolicLink(uuid); DatabaseTrackInfo trk = import_manager.ImportTrack(uuid); //File.Delete (uuid); /*if (trk==null) { * Hyena.Log.Warning ("track = null (file="+e.file ()+")"); * if (stk.Count>0) { trk=stk.Pop (); } * }*/ if (trk == null) { Hyena.Log.Error("track = null (file=" + e.file() + ")"); } else { Hyena.Log.Information("track!=null (file=" + e.file() + ")"); //MySource.DbConnection.BeginTransaction(); trk.PartOfCue = 1; trk.CueAudioFile = e.file(); trk.AlbumTitle = s.title(); //trk.Album=s.title (); trk.AlbumArtist = s.performer(); trk.Composer = (e.Composer == "") ? s.composer() : e.Composer; //trk.ArtworkId=s.getArtId (); //trk.Artist= trk.ArtistName = (e.performer() == "") ? s.performer() : e.performer(); trk.TrackTitle = e.title(); trk.TrackNumber = i + 1; trk.Genre = s.genre(); trk.BeginOffset = e.BeginOffset; trk.EndOffset = e.EndOffset; //trk.Uri=trk.CueAudioUri; //trk.MediaAttributes = TrackMediaAttributes.ExternalResource; //trk.PrimarySource = ServiceManager.SourceManager.MusicLibrary; trk.Save(); //MySource.DbConnection.CommitTransaction(); } } catch (Exception ex) { Hyena.Log.Error(ex.ToString()); } } import_manager.NotifyAllSources(); }
private void setLatinTag(int track,CueSheet s,CueSheetEntry e) { string fn=_file_format; fn=fn.Replace ("@A",s.performer()); fn=fn.Replace ("@b",s.title ()); fn=fn.Replace ("@n",(track+1).ToString ()); fn=fn.Replace ("@t",e.title ()); fn=_directory+"/"+fn+".mp3"; Hyena.Log.Information ("file to convert:"+fn); if (File.Exists(fn)) { TagLib.File file=TagLib.File.Create(fn); if (file==null) { Hyena.Log.Error ("Cannot create taglib file for "+fn); return; } else { Hyena.Log.Information("Setting tags for "+fn); file.Tag.Album=s.title (); file.Tag.AlbumArtists=new string[]{s.performer ()}; file.Tag.Composers=new string[]{s.composer ()}; file.Tag.Genres=new string[]{s.genre ()}; file.Tag.Title=e.title (); file.Tag.Track=(uint) track+1; file.Tag.Performers=new string[]{e.performer ()}; file.Save (); } } }