Skip to content

Commit

Permalink
Merge pull request #11 from walkero-gr/selfupdate
Browse files Browse the repository at this point in the history
Selfupdate
  • Loading branch information
walkero-gr committed Sep 4, 2021
2 parents 9e57f78 + f12c30f commit e0a92f7
Show file tree
Hide file tree
Showing 20 changed files with 437 additions and 92 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ All notable changes to this project will be documented in this file.
## [1.3] - [future]
### Added
- Added right sidebar with station info and avatar image, wherever
this is available
the image is available
- Added a new menu item to check for newer versions and start a
selfupdate, if the user approves it. There is a way to see the
latest changes before update.

### Fixed
- Now the radio list is cleared if the search criteria change and
Expand All @@ -18,6 +21,7 @@ All notable changes to this project will be documented in this file.
and no more stations were found
- Dropped oo.library network support for libcurl. That's why the
executable size is increased so much
- Now oo.library and AmiSSL are not required

## [1.2.1] - 2021-05-31
### Fixed
Expand Down
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Project: MediaVault
#
# Created on: 19-08-2021 22:51:02
# Created on: 04-09-2021 10:28:25
#
#

Expand All @@ -18,7 +18,7 @@ MediaVault_OBJ := \
src/mediavault.o src/libshandler.o src/gui.o \
src/mainWin.o src/guifuncs.o src/aboutWin.o \
src/httpfuncs.o src/radiofuncs.o src/stringfuncs.o \

src/fsfuncs.o


###################################################################
Expand Down Expand Up @@ -96,13 +96,15 @@ src/upnpfuncs.o: src/upnpfuncs.c src/upnpfuncs.h src/globals.h \

src/gui.o: src/gui.c src/globals.h src/version.h \
src/gui.h src/guifuncs.h src/mainWin.h \
src/aboutWin.h
src/aboutWin.h src/radiofuncs.h

src/httpfuncs.o: src/httpfuncs.c src/version.h

src/httpfuncs.o: src/httpfuncs.c
src/fsfuncs.o: src/fsfuncs.c

src/guifuncs.o: src/guifuncs.c src/globals.h src/version.h \
src/gui.h src/guifuncs.h src/radiofuncs.h \

src/httpfuncs.h src/stringfuncs.h

src/mainWin.o: src/mainWin.c src/globals.h src/version.h \
src/gui.h src/mainWin.h
Expand Down
109 changes: 56 additions & 53 deletions MediaVault.cbp
Original file line number Diff line number Diff line change
@@ -1,64 +1,67 @@
<?xml version="1.0" ?>
<CodeBench_Project name="MediaVault" path="Applications:Programming&#047;workspace&#047;MyProjects&#047;mediavault&#047;MediaVault.cbp" created="1353847454" lastmodified="1376952895">
<plugin name="PROGDIR:Plugins&#047;AmigaOS4SDK.CCPlugin" flags="0"/>
<target run="MediaVault"/>
<homedir name="Applications:Programming&#047;workspace&#047;MyProjects&#047;mediavault"/>
<includedir name="Applications:Programming&#047;workspace&#047;MyProjects&#047;mediavault&#047;src"/>
<compiler name="gcc:bin&#047;gcc" switches="-Wall -Werror -Wwrite-strings -Wextra -O3" stack="131072"/>
<linker switches="-lauto"/>
<debugger name="SDK:c&#047;gdb"/>
<builder name="SDK:c&#047;make -f"/>
<environment tabsize="2"/>
<CodeBench_Project name="MediaVault" path="Applications:Programming/workspace/MyProjects/mediavault/MediaVault.cbp" created="1353847454" lastmodified="1378293047">
<plugin name="PROGDIR:Plugins/AmigaOS4SDK.CCPlugin" flags="0" />
<target run="MediaVault" />
<homedir name="Applications:Programming/workspace/MyProjects/mediavault" />
<includedir name="Applications:Programming/workspace/MyProjects/mediavault/src" />
<compiler name="gcc:bin/gcc" switches="-Wall -Werror -Wwrite-strings -Wextra -O3" stack="131072" />
<linker switches="-lauto" />
<debugger name="SDK:c/gdb"/>
<builder name="SDK:c/make -f" />
<environment tabsize="2" />
<headers>
<file name="Applications:Programming&#047;workspace&#047;MyProjects&#047;mediavault&#047;src&#047;libshandler.h" open="0"/>
<file name="Applications:Programming&#047;workspace&#047;MyProjects&#047;mediavault&#047;src&#047;mediavault.h" open="0"/>
<file name="src&#047;globals.h" open="1" top="0" left="0" line="24" row="28"/>
<file name="src&#047;upnpfuncs.h" open="0"/>
<file name="Applications:Programming&#047;workspace&#047;MyProjects&#047;mediavault&#047;src&#047;guifuncs.h" open="0"/>
<file name="Applications:Programming&#047;workspace&#047;MyProjects&#047;mediavault&#047;src&#047;version.h" open="1" top="0" left="0" line="35" row="24"/>
<file name="Applications:Programming&#047;workspace&#047;MyProjects&#047;mediavault&#047;src&#047;httpfuncs.h" open="0"/>
<file name="src&#047;gui.h" open="1" top="28" left="0" line="28" row="31"/>
<file name="src&#047;mainWin.h" open="0"/>
<file name="src&#047;aboutWin.h" open="0"/>
<file name="src&#047;radiofuncs.h" open="0"/>
<file name="src&#047;stringfuncs.h" open="1" top="0" left="0" line="22" row="28"/>
<file name="Applications:Programming/workspace/MyProjects/mediavault/src/libshandler.h" open="0" />
<file name="Applications:Programming/workspace/MyProjects/mediavault/src/mediavault.h" open="0" />
<file name="src/globals.h" open="1" top="0" left="0" line="24" row="28" />
<file name="src/upnpfuncs.h" open="0" />
<file name="Applications:Programming/workspace/MyProjects/mediavault/src/guifuncs.h" open="0" />
<file name="Applications:Programming/workspace/MyProjects/mediavault/src/version.h" open="1" top="0" left="0" line="35" row="24" />
<file name="Applications:Programming/workspace/MyProjects/mediavault/src/httpfuncs.h" open="0" />
<file name="src/gui.h" open="1" top="28" left="0" line="28" row="31" />
<file name="src/mainWin.h" open="0" />
<file name="Applications:Programming/workspace/MyProjects/mediavault/src/fsfuncs.h" open="0" />
<file name="src/aboutWin.h" open="0" />
<file name="src/radiofuncs.h" open="0" />
<file name="src/stringfuncs.h" open="1" top="0" left="0" line="22" row="28" />
</headers>
<sources>
<file name="src&#047;mediavault.c" open="0"/>
<file name="src&#047;libshandler.c" open="1" top="58" left="0" line="88" row="24"/>
<file name="src&#047;upnpfuncs.c" open="0"/>
<file name="src&#047;gui.c" open="1" top="84" left="0" line="110" row="0"/>
<file name="src&#047;httpfuncs.c" open="1" current="1" top="0" left="0" line="12" row="2"/>
<file name="src&#047;guifuncs.c" open="0"/>
<file name="src&#047;mainWin.c" open="1" top="139" left="0" line="147" row="26"/>
<file name="src&#047;aboutWin.c" open="0"/>
<file name="src&#047;radiofuncs.c" open="1" top="211" left="0" line="270" row="0"/>
<file name="src&#047;stringfuncs.c" open="1" top="10" left="0" line="26" row="84"/>
<file name="src/mediavault.c" open="0" />
<file name="src/libshandler.c" open="1" top="58" left="0" line="88" row="24" />
<file name="src/upnpfuncs.c" open="0" />
<file name="src/gui.c" open="1" top="0" left="0" line="110" row="0" />
<file name="src/httpfuncs.c" open="0" />
<file name="src/fsfuncs.c" open="1" top="0" left="0" line="32" row="0" />
<file name="src/guifuncs.c" open="1" current="1" top="550" left="0" line="593" row="8" />
<file name="src/mainWin.c" open="0" />
<file name="src/aboutWin.c" open="0" />
<file name="src/radiofuncs.c" open="0" />
<file name="src/stringfuncs.c" open="0" />
</sources>
<others>
<file name="CHANGELOG.md" open="0"/>
<file name="README.md" open="0"/>
<file name="os4depot.readme" open="0"/>
<file name="Makefile" open="0"/>
<file name=".gitignore" open="0"/>
<file name="CHANGELOG.md" open="0" />
<file name="README.md" open="0" />
<file name="os4depot.readme" open="0" />
<file name="Makefile" open="0" />
<file name=".gitignore" open="0" />
</others>
<flags value="0x0000000000068005"/>
<buildscript name="Makefile" depth="3" open="0"/>
<projectnotes open="0"/>
<buildwindow open="0"/>
<flags value="0x0000000000068001" />
<buildscript name="Makefile" depth="3" open="0" />
<projectnotes open="0" />
<buildwindow open="1" />
<targets>
<target name="MediaVault" linker="gcc:bin&#047;gcc" switches="-lcurl -lrtmp -lssl -lcrypto -lz -lpthread" flags="0x00000002">
<file name="src&#047;mediavault.c"/>
<file name="src&#047;libshandler.c"/>
<file name="src&#047;gui.c"/>
<file name="src&#047;mainWin.c"/>
<file name="src&#047;guifuncs.c"/>
<file name="src&#047;aboutWin.c"/>
<file name="src&#047;httpfuncs.c"/>
<file name="src&#047;radiofuncs.c"/>
<file name="src&#047;stringfuncs.c"/>
<target name="MediaVault" linker="gcc:bin/gcc" switches="-lcurl -lrtmp -lssl -lcrypto -lz -lpthread" flags="0x00000002" >
<file name="src/mediavault.c" />
<file name="src/libshandler.c" />
<file name="src/gui.c" />
<file name="src/mainWin.c" />
<file name="src/guifuncs.c" />
<file name="src/aboutWin.c" />
<file name="src/httpfuncs.c" />
<file name="src/radiofuncs.c" />
<file name="src/stringfuncs.c" />
<file name="src/fsfuncs.c" />
</target>
</targets>
<logfile name="RAM Disk:Build.log"/>
<logfile name="RAM Disk:Build.log" />
<search lastsearch="unicode" sensecase="1" replace_state="0"/>
</CodeBench_Project>
</CodeBench_Project>
Binary file modified MediaVault.cbp.info
Binary file not shown.
Binary file modified MediaVault.info
Binary file not shown.
13 changes: 9 additions & 4 deletions Project Notes
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ DONE - Application registration
DONE - Window can jump screen
DONE - Window size and position can be saved
DONE - Changed the way classes and gadgets are initiallized
DONE - Download avatar images in cache folder
- Add play button at the right sidebar menu and replace double click
DONE - Add libcurl support

DONE - [v1.3] Download avatar images in cache folder
- [v1.3] Add play button at the right sidebar menu and replace double click
DONE - [v1.3] Selfupdate process
DONE - [v1.3] Add libcurl support
- Simplify downloadFile() to make one http request
- Add progress window at the Selfupdate process
- [v1.3] Add new icons in the archive, the ones that IconDesigner created
- [v1.3] Fix icons' positions
- [v1.3] Create automated release packaging in Makefile

## Radio
DONE - Add Radio filter section with fields at the top of the window (Genre, Language, Country, Name)
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ https://github.com/walkero-gr/mediavault/issues
Changelog
--------------------------

v1.3.0 - future
* Added right sidebar with station info and avatar image, wherever the image is available
* Added a new menu item to check for newer versions and start a selfupdate, if the user approves it. There is a way to see the latest changes before update.
* Now the radio list is cleared if the search criteria change and no radio stations are found
* Now the list is not cleared if the "Discover More" button is clicked and no more stations were found
* Fixed a possible crash on window closing
* Added a new message in case the "Discover More" button is clicked and no more stations were found
* Dropped oo.library network support for libcurl, which more mature and has a lot more options and features. Unfortunately that increased the executable size a lot.
* Now oo.library and AmiSSL are not required

v1.2.1 - 2021-05-31
* Reduced results to 20 as a temporary workaround of a bug that occurs with the default discovery of radio stations. Found where the problem is and it will be fixed on a later release.
* Disabled the load of the window when AmiSSL 4.9 is missing
Expand Down
77 changes: 77 additions & 0 deletions src/fsfuncs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@




#include "globals.h"
#include "httpfuncs.h"

STRPTR getFilePath(STRPTR filename)
{
STRPTR appPath = IExec->AllocVecTags(sizeof(char) * 255,
AVT_Type, MEMF_SHARED,
AVT_ClearWithValue, "\0",
TAG_DONE);

BPTR fileLock = IDOS->Lock(filename, SHARED_LOCK);
if (fileLock)
{
IDOS->NameFromLock(fileLock, appPath, sizeof(char) * 255);

IDOS->UnLock(fileLock);
//IExec->FreeVec(appPath);
return appPath;
}

return NULL;
}

STRPTR getParentPath(STRPTR filename)
{
STRPTR appPath = IExec->AllocVecTags(sizeof(char) * 255,
AVT_Type, MEMF_SHARED,
AVT_ClearWithValue, "\0",
TAG_DONE);

BPTR fileLock = IDOS->Lock(filename, SHARED_LOCK);
if (fileLock)
{
BPTR folderLock = IDOS->ParentDir(fileLock);
BPTR parentLock = IDOS->ParentDir(folderLock);
IDOS->NameFromLock(parentLock, appPath, sizeof(char) * 255);

IDOS->UnLock(parentLock);
IDOS->UnLock(folderLock);
IDOS->UnLock(fileLock);
//IExec->FreeVec(appPath);
return appPath;
}

return NULL;

}

BOOL downloadLatestUpdate(STRPTR releaseUrl)
{
return downloadFile(releaseUrl, (STRPTR)"mediavault_update", (STRPTR)"RAM:");
}

int32 unarcFile(STRPTR filename, STRPTR targetFolder)
{
BPTR fileLock = IDOS->Lock(filename, SHARED_LOCK);
if (fileLock)
{
STRPTR cmd = IUtility->ASPrintf("c:xadUnFile FROM \"%s\" DESTDIR %s OW Q ", filename, targetFolder);

int32 result = IDOS->SystemTags( cmd,
SYS_Input, ZERO,
SYS_Output, NULL,
SYS_Error, ZERO,
SYS_Asynch, FALSE,
TAG_DONE);

IDOS->UnLock(fileLock);
return result;
}

return -2;
}
26 changes: 26 additions & 0 deletions src/fsfuncs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
************************************************************
**
** Created by: codebench 0.55 (19.10.2017)
**
** Project: MediaVault
**
** File: fsfuncs.h
**
** Date: 17-04-2021 10:59:22
**
************************************************************
*/


#ifndef _FSFUNCS_H
#define _FSFUNCS_H

STRPTR getFilePath(STRPTR);
STRPTR getParentPath(STRPTR);
BOOL downloadLatestUpdate(STRPTR);
int32 unarcFile(STRPTR, STRPTR);

#endif
4 changes: 2 additions & 2 deletions src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <proto/amijansson.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/icon.h>
#include <proto/intuition.h>
Expand All @@ -28,7 +28,7 @@

#include <string.h>
#include <ctype.h>

#include <jansson/jansson.h>

#include "version.h"
Expand Down
12 changes: 10 additions & 2 deletions src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,22 +181,29 @@ void showGUI(void)
case WMHI_CLOSEWINDOW:
done = TRUE;
break;

case WMHI_ICONIFY:
if (appHide(appID, objects[OID_MAIN], WM_ICONIFY) == TRUE)
{
windows[WID_MAIN] = NULL;
}
break;

case WMHI_UNICONIFY:
windows[WID_MAIN] = appUnhide(appID, objects[OID_MAIN]);
if (windows[WID_MAIN] == NULL) done = TRUE; // error re-opening the window
break;

case WMHI_MENUPICK:
selectedMenu = NO_MENU_ID;

while ((selectedMenu = IIntuition->IDoMethod(menus[MID_PROJECT], MM_NEXTSELECT, 0, selectedMenu, TAG_DONE)) != NO_MENU_ID)
{
switch (selectedMenu)
{
case MID_CHECKUPDATES:
workOnUpdate();
break;
case MID_ICONIFY:
if (appHide(appID, objects[OID_MAIN], WM_ICONIFY) == TRUE)
{
Expand Down Expand Up @@ -431,11 +438,11 @@ static void listStations(
if (stationsCnt == ~0UL)
{
char jsonErrorMsg[] = "There was an error with the returned data.\nPlease try again or check your network.";
showMsgReq(gadgets[GID_MSG_REQ], "MediaVault error", (char *)jsonErrorMsg);
showMsgReq(gadgets[GID_MSG_REQ], "MediaVault error", (char *)jsonErrorMsg, 0, NULL, 0);
}
else if (stationsCnt == 0)
{
showMsgReq(gadgets[GID_MSG_REQ], "MediaVault info", notFoundMsg);
showMsgReq(gadgets[GID_MSG_REQ], "MediaVault info", notFoundMsg, 0, NULL, 0);
}
else if (stationsCnt == maxRadioResults)
{
Expand Down Expand Up @@ -554,3 +561,4 @@ static void fillLeftSidebar(void)
LISTBROWSER_ColumnInfo, leftSidebarCI,
TAG_DONE);
}

1 change: 1 addition & 0 deletions src/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ enum
enum
{
MID_PROJECT = 1, /* Zero is an invalid value for a menu ID */
MID_CHECKUPDATES,
MID_ABOUT,
MID_ICONIFY,
MID_QUIT,
Expand Down
Loading

0 comments on commit e0a92f7

Please sign in to comment.