corections for album tag editor
This commit is contained in:
@@ -194,6 +194,33 @@ void WindowTitle(const string &status)
|
|||||||
printf("\033]0;%s\7",status.c_str());
|
printf("\033]0;%s\7",status.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string FindSharedDir(Menu<Song> *menu)
|
||||||
|
{
|
||||||
|
SongList list;
|
||||||
|
for (int i = 0; i < menu->Size(); i++)
|
||||||
|
list.push_back(&menu->at(i));
|
||||||
|
return FindSharedDir(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
string FindSharedDir(const SongList &v)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
if (!v.empty())
|
||||||
|
{
|
||||||
|
result = v.front()->GetFile();
|
||||||
|
for (SongList::const_iterator it = v.begin()+1; it != v.end(); it++)
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
while (result.substr(0, i) == (*it)->GetFile().substr(0, i))
|
||||||
|
i++;
|
||||||
|
result = result.substr(0, i);
|
||||||
|
}
|
||||||
|
int slash = result.find_last_of("/");
|
||||||
|
result = slash != string::npos ? result.substr(0, slash) : "/";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
string TotalPlaylistLength()
|
string TotalPlaylistLength()
|
||||||
{
|
{
|
||||||
const int MINUTE = 60;
|
const int MINUTE = 60;
|
||||||
@@ -265,6 +292,8 @@ string DisplayTag(const Song &s, void *data)
|
|||||||
return s.GetGenre();
|
return s.GetGenre();
|
||||||
case 6:
|
case 6:
|
||||||
return s.GetComment();
|
return s.GetComment();
|
||||||
|
case 8:
|
||||||
|
return s.GetShortFilename();
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ bool Keypressed(int, const int *);
|
|||||||
bool SortSongsByTrack(Song *, Song *);
|
bool SortSongsByTrack(Song *, Song *);
|
||||||
|
|
||||||
void WindowTitle(const string &);
|
void WindowTitle(const string &);
|
||||||
|
string FindSharedDir(Menu<Song> *);
|
||||||
|
string FindSharedDir(const SongList &);
|
||||||
string TotalPlaylistLength();
|
string TotalPlaylistLength();
|
||||||
string DisplayTag(const Song &, void *);
|
string DisplayTag(const Song &, void *);
|
||||||
string DisplayItem(const Item &, void * = NULL);
|
string DisplayItem(const Item &, void * = NULL);
|
||||||
|
|||||||
@@ -706,7 +706,7 @@ int main(int argc, char *argv[])
|
|||||||
mEditorTags->Refresh();
|
mEditorTags->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
mEditorTagTypes->GetChoice() < 7 ? mEditorTags->Refresh(1) : mEditorTags->Window::Clear();
|
mEditorTagTypes->GetChoice() < 10 ? mEditorTags->Refresh(1) : mEditorTags->Window::Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// album editor end
|
// album editor end
|
||||||
@@ -754,7 +754,6 @@ int main(int argc, char *argv[])
|
|||||||
else if (wCurrent == mEditorAlbums)
|
else if (wCurrent == mEditorAlbums)
|
||||||
{
|
{
|
||||||
mEditorTags->Clear(0);
|
mEditorTags->Clear(0);
|
||||||
mEditorTagTypes->Reset();
|
|
||||||
mEditorTagTypes->Refresh();
|
mEditorTagTypes->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1354,11 +1353,11 @@ int main(int argc, char *argv[])
|
|||||||
case 6:
|
case 6:
|
||||||
set = &Song::SetComment;
|
set = &Song::SetComment;
|
||||||
break;
|
break;
|
||||||
case 7: // reset
|
case 8: // reset
|
||||||
mEditorTags->Clear(0);
|
mEditorTags->Clear(0);
|
||||||
ShowMessage("Changes reset");
|
ShowMessage("Changes reset");
|
||||||
continue;
|
continue;
|
||||||
case 8: // save
|
case 9: // save
|
||||||
{
|
{
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
ShowMessage("Writing changes...");
|
ShowMessage("Writing changes...");
|
||||||
@@ -1379,7 +1378,7 @@ int main(int argc, char *argv[])
|
|||||||
wCurrent->Refresh();
|
wCurrent->Refresh();
|
||||||
wCurrent = mEditorAlbums;
|
wCurrent = mEditorAlbums;
|
||||||
mEditorAlbums->HighlightColor(Config.active_column_color);
|
mEditorAlbums->HighlightColor(Config.active_column_color);
|
||||||
Mpd->UpdateDirectory("/");
|
Mpd->UpdateDirectory(FindSharedDir(mEditorTags));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mEditorTags->Clear(0);
|
mEditorTags->Clear(0);
|
||||||
@@ -1388,7 +1387,7 @@ int main(int argc, char *argv[])
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (wCurrent == mEditorTagTypes)
|
if (wCurrent == mEditorTagTypes && set != NULL)
|
||||||
{
|
{
|
||||||
LOCK_STATUSBAR;
|
LOCK_STATUSBAR;
|
||||||
wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]" + mEditorTagTypes->GetOption() + "[/b]: ", 1);
|
wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]" + mEditorTagTypes->GetOption() + "[/b]: ", 1);
|
||||||
@@ -1400,7 +1399,7 @@ int main(int argc, char *argv[])
|
|||||||
for (int i = 0; i < mEditorTags->Size(); i++)
|
for (int i = 0; i < mEditorTags->Size(); i++)
|
||||||
(mEditorTags->at(i).*set)(new_tag);
|
(mEditorTags->at(i).*set)(new_tag);
|
||||||
}
|
}
|
||||||
else if (wCurrent == mEditorTags)
|
else if (wCurrent == mEditorTags && set != NULL)
|
||||||
{
|
{
|
||||||
LOCK_STATUSBAR;
|
LOCK_STATUSBAR;
|
||||||
wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]" + mEditorTagTypes->GetOption() + "[/b]: ", 1);
|
wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]" + mEditorTagTypes->GetOption() + "[/b]: ", 1);
|
||||||
@@ -1542,7 +1541,7 @@ int main(int argc, char *argv[])
|
|||||||
wCurrent = mEditorTagTypes;
|
wCurrent = mEditorTagTypes;
|
||||||
mEditorTagTypes->HighlightColor(Config.active_column_color);
|
mEditorTagTypes->HighlightColor(Config.active_column_color);
|
||||||
}
|
}
|
||||||
else if (wCurrent == mEditorTagTypes && mEditorTagTypes->GetChoice() < 7)
|
else if (wCurrent == mEditorTagTypes && mEditorTagTypes->GetChoice() < 10)
|
||||||
{
|
{
|
||||||
mEditorTagTypes->HighlightColor(Config.main_highlight_color);
|
mEditorTagTypes->HighlightColor(Config.main_highlight_color);
|
||||||
wCurrent->Refresh();
|
wCurrent->Refresh();
|
||||||
@@ -2101,6 +2100,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
SongList list;
|
SongList list;
|
||||||
|
ShowMessage("Updating tags...");
|
||||||
Mpd->StartSearch(1);
|
Mpd->StartSearch(1);
|
||||||
Mpd->AddSearch(MPD_TAG_ITEM_ARTIST, mLibArtists->GetOption());
|
Mpd->AddSearch(MPD_TAG_ITEM_ARTIST, mLibArtists->GetOption());
|
||||||
Mpd->CommitSearch(list);
|
Mpd->CommitSearch(list);
|
||||||
@@ -2117,7 +2117,7 @@ int main(int argc, char *argv[])
|
|||||||
f.save();
|
f.save();
|
||||||
}
|
}
|
||||||
if (success)
|
if (success)
|
||||||
Mpd->UpdateDirectory("/");
|
Mpd->UpdateDirectory(FindSharedDir(list));
|
||||||
FreeSongList(list);
|
FreeSongList(list);
|
||||||
ShowMessage(success ? "Tags written succesfully!" : "Error while writing tags!");
|
ShowMessage(success ? "Tags written succesfully!" : "Error while writing tags!");
|
||||||
}
|
}
|
||||||
@@ -2132,6 +2132,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
SongList list;
|
SongList list;
|
||||||
|
ShowMessage("Updating tags...");
|
||||||
Mpd->StartSearch(1);
|
Mpd->StartSearch(1);
|
||||||
Mpd->AddSearch(MPD_TAG_ITEM_ARTIST, mLibArtists->GetOption());
|
Mpd->AddSearch(MPD_TAG_ITEM_ARTIST, mLibArtists->GetOption());
|
||||||
Mpd->AddSearch(MPD_TAG_ITEM_ALBUM, vLibAlbums[mLibAlbums->GetOption()]);
|
Mpd->AddSearch(MPD_TAG_ITEM_ALBUM, vLibAlbums[mLibAlbums->GetOption()]);
|
||||||
@@ -2149,7 +2150,7 @@ int main(int argc, char *argv[])
|
|||||||
f.save();
|
f.save();
|
||||||
}
|
}
|
||||||
if (success)
|
if (success)
|
||||||
Mpd->UpdateDirectory("/");
|
Mpd->UpdateDirectory(FindSharedDir(list));
|
||||||
FreeSongList(list);
|
FreeSongList(list);
|
||||||
ShowMessage(success ? "Tags written succesfully!" : "Error while writing tags!");
|
ShowMessage(success ? "Tags written succesfully!" : "Error while writing tags!");
|
||||||
}
|
}
|
||||||
@@ -2796,6 +2797,8 @@ int main(int argc, char *argv[])
|
|||||||
mEditorTagTypes->AddOption("Genre");
|
mEditorTagTypes->AddOption("Genre");
|
||||||
mEditorTagTypes->AddOption("Comment");
|
mEditorTagTypes->AddOption("Comment");
|
||||||
mEditorTagTypes->AddSeparator();
|
mEditorTagTypes->AddSeparator();
|
||||||
|
mEditorTagTypes->AddOption("Filename");
|
||||||
|
mEditorTagTypes->AddSeparator();
|
||||||
mEditorTagTypes->AddOption("Reset");
|
mEditorTagTypes->AddOption("Reset");
|
||||||
mEditorTagTypes->AddOption("Save");
|
mEditorTagTypes->AddOption("Save");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user