Skip to content

Commit

Permalink
Merge pull request #36 from ua0lnj/master
Browse files Browse the repository at this point in the history
Version 1.6.0.
  • Loading branch information
ua0lnj authored Jan 27, 2024
2 parents ac80df6 + b00503d commit 09e73a3
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 27 deletions.
3 changes: 3 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ cMpvPluginConfig::cMpvPluginConfig()
ShowMediaTitle = 0;
ShowSubtitles = 0;
ExitAtEnd = 1;
ShowAfterStop = 0;
SavePos = 0;
SoftVol = 0;

Expand Down Expand Up @@ -179,6 +180,8 @@ bool cMpvPluginConfig::SetupParse(const char *name, const char *value)
ShowSubtitles = atoi(value);
else if (!strcasecmp(name, "ExitAtEnd"))
ExitAtEnd = atoi(value);
else if (!strcasecmp(name, "ShowAfterStop"))
ShowAfterStop = atoi(value);
else if (!strcasecmp(name, "SavePos"))
SavePos = atoi(value);
else if (!strcasecmp(name, "SoftVol"))
Expand Down
1 change: 1 addition & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class cMpvPluginConfig
int ShowMediaTitle; // show title from media file instead of filename
int ShowSubtitles; // show subtitles
int ExitAtEnd; // exit at the end
int ShowAfterStop; // show after stop: 0 - black screen, 1 - filebrowser
int SavePos; // save position on quit
int SoftVol; // software volume

Expand Down
23 changes: 14 additions & 9 deletions control.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ void cMpvControl::ShowProgress(int playlist)
DisplayReplay->SetMode(!Player->IsPaused(), true, Speed);

if (playlist)
{
DisplayReplay->SetCurrent(itoa(Player->CurrentListPos()));
DisplayReplay->SetTotal(itoa(Player->TotalListPos()));
}
else
{
DisplayReplay->SetCurrent(IndexToHMSF(Player->CurrentPlayTime(), false, 1));
DisplayReplay->SetTotal(IndexToHMSF(Player->TotalPlayTime(), false, 1));
}
{
DisplayReplay->SetCurrent(itoa(Player->CurrentListPos()));
DisplayReplay->SetTotal(itoa(Player->TotalListPos()));
}
else
{
DisplayReplay->SetCurrent(IndexToHMSF(Player->CurrentPlayTime(), false, 1));
DisplayReplay->SetTotal(IndexToHMSF(Player->TotalPlayTime(), false, 1));
}
SetNeedsFastResponse(true);
Skins.Flush();
}
Expand Down Expand Up @@ -318,6 +318,11 @@ eOSState cMpvControl::ProcessKey(eKeys key)
if (MpvPluginConfig->SavePos && !Player->NetworkPlay())
Player->SavePosPlayer();
Player->StopPlayer();
if (MpvPluginConfig->ShowAfterStop == 1)
{
MpvPluginConfig->ShowOptions = 0;
cRemote::CallPlugin("mpv");
}
}
else
{
Expand Down
28 changes: 18 additions & 10 deletions filebrowser.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ eOSState cMpvFilebrowser::ProcessKey(eKeys Key)
string newPath = "";
cMpvFilebrowserMenuItem *item;
eOSState State;
int index = 0;
switch (Key)
{
case kOk:
Expand Down Expand Up @@ -265,6 +266,7 @@ eOSState cMpvFilebrowser::ProcessKey(eKeys Key)
item = (cMpvFilebrowserMenuItem *) Get(Current());
if (!item) break;
newPath = item->Path() + "/" + item->Text();
index = item->Index();
if (item->IsDirectory())
{
int res;
Expand All @@ -279,39 +281,45 @@ eOSState cMpvFilebrowser::ProcessKey(eKeys Key)
if (Skins.Message(mtWarning, tr("Remove empty directory?"), 5) == kOk)
{
res = rmdir(newPath.c_str());
dsyslog("[mpv] remove %s %d\n", newPath.c_str(), res);
if (res)
{
Skins.Message(mtError, tr("Unable to remove directory!"));
ShowDirectory(currentDir);
}
else
{
State = cOsdMenu::ProcessKey(kUp);
item = (cMpvFilebrowserMenuItem *) Get(Current());
if (!item) break;
currentItem = item->Text();
ShowDirectory(currentDir);
return State;
if (index)
{
item = (cMpvFilebrowserMenuItem *) Get(index-1);
if (!item) break;
currentItem = item->Text();
}
}
}
}
ShowDirectory(currentDir);
}
else
{
if (Skins.Message(mtWarning, tr("Remove file?"), 5) == kOk)
{
int res;
res = remove(newPath.c_str());
ShowDirectory(currentDir);
dsyslog("[mpv] remove %s %d\n", newPath.c_str(), res);
if (res)
{
Skins.Message(mtError, tr("Unable to remove file!"));
}
else
{
State = cOsdMenu::ProcessKey(kUp);
return State;
if (index)
{
item = (cMpvFilebrowserMenuItem *) Get(index-1);
if (!item) break;
currentItem = item->Text();
}
}
ShowDirectory(currentDir);
}
}
return osContinue;
Expand Down
8 changes: 4 additions & 4 deletions menu_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ eOSState cMpvMenuOptions::ProcessKey(eKeys Key)
switch (Key)
{
case kOk:
if(State == osUser1)
AddSubMenu(new cMpvMenuChapters(player));
if(State == osUser2)
AddSubMenu(new cMpvMenuPlaylist(player));
if(State == osUser1)
AddSubMenu(new cMpvMenuChapters(player));
if(State == osUser2)
AddSubMenu(new cMpvMenuPlaylist(player));
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion mpv.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "menu_options.h"
#include "mpv_service.h"

static const char *VERSION = "1.5.2"
static const char *VERSION = "1.6.0"
#ifdef GIT_REV
"-GIT" GIT_REV
#endif
Expand Down
26 changes: 25 additions & 1 deletion po/it_IT.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: VDR \n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2021-02-11 22:27+1000\n"
"POT-Creation-Date: 2024-01-28 01:08+1000\n"
"PO-Revision-Date: \n"
"Last-Translator: fiveten_59\n"
"Language-Team: fiveten_59\n"
Expand Down Expand Up @@ -56,12 +56,30 @@ msgstr "Disco"
msgid "PlayDir"
msgstr "Riproduzione continua"

msgid "Remove"
msgstr ""

msgid "Shuffle"
msgstr "Riproduzione casuale"

msgid "Playlist cannot be created!"
msgstr "La playlist non può essere creata!"

msgid "Not empty directory, can't remove!"
msgstr ""

msgid "Remove empty directory?"
msgstr ""

msgid "Unable to remove directory!"
msgstr ""

msgid "Remove file?"
msgstr ""

msgid "Unable to remove file!"
msgstr ""

msgid "Options"
msgstr "Opzioni"

Expand All @@ -83,6 +101,9 @@ msgstr "Registrazione in corso - play non disponibile!"
msgid "mpv player plugin"
msgstr "mpv player plugin"

msgid "Black screen"
msgstr "Schermo nero"

msgid "Hide main menu entry"
msgstr "Nascondere menù principale"

Expand Down Expand Up @@ -116,5 +137,8 @@ msgstr "Mostra sottotitoli"
msgid "Exit at the end"
msgstr "Uscire al termine"

msgid "Show after stop"
msgstr "Mostra dopo fermata"

msgid "Save position on quit"
msgstr "Salva la posizione all'uscita"
8 changes: 7 additions & 1 deletion po/ru_RU.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-mpv 0.0.4\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2024-01-07 14:59+1000\n"
"POT-Creation-Date: 2024-01-28 01:08+1000\n"
"PO-Revision-Date: 2020-01-12 01:04+1000\n"
"Last-Translator: ua0lnj\n"
"Language-Team: ua0lnj\n"
Expand Down Expand Up @@ -101,6 +101,9 @@ msgstr "Запись - нельзя проиграть!"
msgid "mpv player plugin"
msgstr "MPV плагин"

msgid "Black screen"
msgstr "Чёрный экран"

msgid "Hide main menu entry"
msgstr "Скрыть основное меню"

Expand Down Expand Up @@ -134,5 +137,8 @@ msgstr "Показ субтитров"
msgid "Exit at the end"
msgstr "Выход в конце"

msgid "Show after stop"
msgstr "Показать после остановки"

msgid "Save position on quit"
msgstr "Запомнить позицию"
12 changes: 11 additions & 1 deletion setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cMpvPluginSetup::cMpvPluginSetup()
SetupShowMediaTitle = MpvPluginConfig->ShowMediaTitle;
SetupShowSubtitles = MpvPluginConfig->ShowSubtitles;
SetupExitAtEnd = MpvPluginConfig->ExitAtEnd;
SetupShowAfterStop = MpvPluginConfig->ShowAfterStop;
SetupSavePos = MpvPluginConfig->SavePos;
SetupSoftVol = MpvPluginConfig->SoftVol;
Setup();
Expand All @@ -31,17 +32,23 @@ eOSState cMpvPluginSetup::ProcessKey(eKeys key)
int oldUsePassthrough = SetupUsePassthrough;
int oldSoftVol = SetupSoftVol;
int oldPlaylistOnNextKey = SetupPlaylistOnNextKey;
int oldSetupExitAtEnd = SetupExitAtEnd;
eOSState state = cMenuSetupPage::ProcessKey(key);

if (key != kNone && (SetupUsePassthrough != oldUsePassthrough || SetupPlaylistOnNextKey != oldPlaylistOnNextKey ||
SetupSoftVol != oldSoftVol))
SetupSoftVol != oldSoftVol || SetupExitAtEnd != oldSetupExitAtEnd))
Setup();

return state;
}

void cMpvPluginSetup::Setup()
{
static const char *const show_after_stop[] = {
tr("Black screen"), tr("Filebrowser"),
};


int current = Current();
Clear();

Expand All @@ -59,6 +66,8 @@ void cMpvPluginSetup::Setup()
Add(new cMenuEditBoolItem(tr("Show media title instead of filename"), &SetupShowMediaTitle));
Add(new cMenuEditBoolItem(tr("Show subtitles"), &SetupShowSubtitles));
Add(new cMenuEditBoolItem(tr("Exit at the end"), &SetupExitAtEnd));
if (!SetupExitAtEnd)
Add(new cMenuEditStraItem(tr("Show after stop"), &SetupShowAfterStop, 2, show_after_stop));
Add(new cMenuEditBoolItem(tr("Save position on quit"), &SetupSavePos));
SetCurrent(Get(current));
Display();
Expand All @@ -76,6 +85,7 @@ void cMpvPluginSetup::Store()
SetupStore("ShowMediaTitle", MpvPluginConfig->ShowMediaTitle = SetupShowMediaTitle);
SetupStore("ShowSubtitles", MpvPluginConfig->ShowSubtitles = SetupShowSubtitles);
SetupStore("ExitAtEnd", MpvPluginConfig->ExitAtEnd = SetupExitAtEnd);
SetupStore("ShowAfterStop", MpvPluginConfig->ShowAfterStop = SetupShowAfterStop);
SetupStore("SavePos", MpvPluginConfig->SavePos = SetupSavePos);
SetupStore("SoftVol", MpvPluginConfig->SoftVol = SetupSoftVol);
}
Expand Down
1 change: 1 addition & 0 deletions setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class cMpvPluginSetup:public cMenuSetupPage
int SetupShowMediaTitle;
int SetupShowSubtitles;
int SetupExitAtEnd;
int SetupShowAfterStop;
int SetupSavePos;
int SetupSoftVol;

Expand Down

0 comments on commit 09e73a3

Please sign in to comment.