diff --git a/CHANGELOG.md b/CHANGELOG.md index d9fee48..22bed7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Changelog All notable changes to this project will be documented in this file. +## [1.2.1] - 2021-05-31 +### Fixed +- 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 +- Fixed the exit of MediaVault when a library is not available +- Fixed the issue with duplicate results when "discover more" was clicked +- Fixed a crash that had to do with a broken API response. Now an info requester appears. + ## [1.2.0] - 2021-05-27 ### Added - Added Unicode conversion to system charset on radio station names - Thanks to Daniel "trixie" Jedlicka diff --git a/MediaVault.cbp b/MediaVault.cbp index 99e16aa..9d5a2ee 100755 --- a/MediaVault.cbp +++ b/MediaVault.cbp @@ -1,5 +1,5 @@ - + @@ -27,7 +27,7 @@ - + @@ -36,15 +36,15 @@ - - - + + + - + diff --git a/README.md b/README.md index 340da59..a1cac09 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Requirements * oo.library v1.13 by Tuomas Hokka * jansson.library v2.12.1 by Simon Tyrrell * AmigaAmp3 v3.29 by Thomas Wenzel +* AmiSSL 4.9 by the AmiSSL Open Source Team I would like to thank -------------------------- @@ -64,28 +65,26 @@ https://github.com/walkero-gr/mediavault/issues Changelog -------------------------- + +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 +* Fixed the exit of MediaVault when a library is not available +* Fixed the issue with duplicate results when "discover more" was clicked +* Fixed a crash that had to do with a broken API response. Now an info requester appears. + v1.2.0 - 2021-05-27 -* Added Unicode conversion to system charset on radio station names - - Thanks to Daniel "trixie" Jedlicka -* Now the application registers properly and can get requests from other - apps, like Exchanger - Thanks to Daniel "trixie" Jedlicka -* Now the MediaVault can jump to different screens - Thanks to Daniel - "trixie" Jedlicka -* Added better error manipulation when there were API response errors - - Thanks to Daniel "trixie" Jedlicka -* Now the size and the position of the window can be saved by the Popup - Gadget - Thanks to Daniel "trixie" Jedlicka -* Added code to detach the listbrowser before change it's data. That's the - way it should be done -* Restructured code to reduce the duplicated code in radiofuncs.c. Now, one - method is used instead of three separated that had pretty much the same - code. Better code, less problems. +* Added Unicode conversion to system charset on radio station names - Thanks to Daniel "trixie" Jedlicka +* Now the application registers properly and can get requests from other apps, like Exchanger - Thanks to Daniel "trixie" Jedlicka +* Now the MediaVault can jump to different screens - Thanks to Daniel "trixie" Jedlicka +* Added better error manipulation when there were API response errors - Thanks to Daniel "trixie" Jedlicka +* Now the size and the position of the window can be saved by the Popup Gadget - Thanks to Daniel "trixie" Jedlicka +* Added code to detach the listbrowser before change it's data. That's the way it should be done +* Restructured code to reduce the duplicated code in radiofuncs.c. Now, one method is used instead of three separated that had pretty much the same code. Better code, less problems. * A lot of refactoring, removing global variables. * Reduced a lot of duplicated code. -* Now the default radio station number increased to 50. The response is also - much faster - Thanks to Tuomas Hokka and oo.library 1.13 fixes -* Changed the way classes and gadgets are initiallized - Thanks to Daniel - "trixie" Jedlicka +* Now the default radio station number increased to 50. The response is also much faster - Thanks to Tuomas Hokka and oo.library 1.13 fixes +* Changed the way classes and gadgets are initiallized - Thanks to Daniel "trixie" Jedlicka v1.1.1 - 2021-05-15 * Changed the required oo.library version to 1.12 @@ -93,13 +92,10 @@ v1.1.1 - 2021-05-15 v1.1.0 - 2021-05-13 * Added a message requester for messages to the user -* The "Discover" button changes to "Discover more" after the first search, - so to load more radio stations results. If the user change a filter, then - it resets. +* The "Discover" button changes to "Discover more" after the first search, so to load more radio stations results. If the user change a filter, then it resets. * Added more options at the Genre select box * Added more options at the countries and languages select boxes -* Now the retrieved radio stations list doesn't include the marked as broken - stations +* Now the retrieved radio stations list doesn't include the marked as broken stations * Added Trending list of radio stations * Added Popular list of radio stations * Changed columns' widths on listbrowsers to be weighted diff --git a/os4depot.readme b/os4depot.readme index 3459f97..ce3c6e6 100644 --- a/os4depot.readme +++ b/os4depot.readme @@ -1,6 +1,6 @@ name: mediavault description: Discover online radio stations -version: 1.2.0 +version: 1.2.1 author: George Sokianos submitter: George Sokianos email: walkero@gmail.com @@ -43,6 +43,7 @@ Requirements * oo.library v1.13 by Tuomas Hokka * jansson.library v2.12.1 by Simon Tyrrell * AmigaAmp3 v3.29 by Thomas Wenzel +* AmiSSL 4.9 by the AmiSSL Open Source Team I would like to thank -------------------------- @@ -73,6 +74,17 @@ https://github.com/walkero-gr/mediavault/issues Changelog -------------------------- + +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 +* Fixed the exit of MediaVault when a library is not available +* Fixed the issue with duplicate results when "discover more" was clicked +* Fixed a crash that had to do with a broken API response. Now an info requester + appears. + v1.2.0 - 2021-05-27 * Added Unicode conversion to system charset on radio station names - Thanks to Daniel "trixie" Jedlicka diff --git a/src/gui.c b/src/gui.c index 050894a..923c0c6 100755 --- a/src/gui.c +++ b/src/gui.c @@ -172,7 +172,7 @@ void showGUI(void) res_node, lsbNodeIdx; - // Main Window events + //// Main Window events while ((result = IIntuition->IDoMethod(objects[OID_MAIN], WM_HANDLEINPUT, &code, TAG_DONE))) { switch (result & WMHI_CLASSMASK) @@ -462,7 +462,7 @@ static void listStations( net = NULL; } - if (stationsCnt > 0) + if ((stationsCnt != ~0UL) && (stationsCnt > 0)) { IIntuition->SetGadgetAttrs(listbrowser, windows[WID_MAIN], NULL, LISTBROWSER_Labels, list, @@ -470,7 +470,6 @@ static void listStations( LISTBROWSER_Selected, -1, LISTBROWSER_ColumnInfo, columnInfo, TAG_DONE); - } } diff --git a/src/libshandler.c b/src/libshandler.c index 9d993e4..910ef1b 100644 --- a/src/libshandler.c +++ b/src/libshandler.c @@ -78,99 +78,101 @@ int CleanExit(const char *str) IDOS->Printf("Error::%s\n",str); return RETURN_ERROR; } - + return RETURN_OK; } -void OpenLibs(void) +int OpenLibs(void) { //// Libraries if ((ApplicationBase = IExec->OpenLibrary( "application.library", 53 ))) { IApplication = (struct ApplicationIFace *)IExec->GetInterface( ApplicationBase, "application", 2, NULL ); - if(!IApplication) CleanExit("Can't open application.library Interface"); + if(!IApplication) return CleanExit("Can't open application.library Interface"); } - else CleanExit("Can't open application.library version 53"); + else return CleanExit("Can't open application.library version 53"); if ((IntuitionBase = IExec->OpenLibrary( "intuition.library", 54 ))) { if (LIB_IS_AT_LEAST(IntuitionBase, 54, 6)) { IIntuition = (struct IntuitionIFace *)IExec->GetInterface( IntuitionBase, "main", 1, NULL ); - if(!IIntuition) CleanExit("Can't open intuition.library Interface"); + if(!IIntuition) return CleanExit("Can't open intuition.library Interface"); } - else CleanExit("Can't open intuition.library version 54.6 and above"); + else return CleanExit("Can't open intuition.library version 54.6 and above"); } - else CleanExit("Can't open intuition.library version 54"); + else return CleanExit("Can't open intuition.library version 54"); if ((UtilityBase = IExec->OpenLibrary( "utility.library", 53 ))) { IUtility = (struct UtilityIFace *)IExec->GetInterface( UtilityBase, "main", 1, NULL ); - if(!IUtility) CleanExit("Can't open utility.library Interface"); + if(!IUtility) return CleanExit("Can't open utility.library Interface"); } - else CleanExit("Can't open utility.library version 53"); + else return CleanExit("Can't open utility.library version 53"); if ((JanssonBase = IExec->OpenLibrary( "jansson.library", 2 ))) { IJansson = (struct JanssonIFace *)IExec->GetInterface( JanssonBase, "main", 1, NULL ); - if(!IJansson) CleanExit("Can't open jansson.library Interface"); + if(!IJansson) return CleanExit("Can't open jansson.library Interface"); } - else CleanExit("Can't open jansson.library version 2"); + else return CleanExit("Can't open jansson.library version 2"); + + if ((AmiSSLMasterBase = IExec->OpenLibrary("amisslmaster.library", 4 ))) + { + if (!LIB_IS_AT_LEAST(AmiSSLMasterBase, 4, 9)) + return CleanExit("Can't open amisslmaster.library version 4.9 and above"); + } + else return CleanExit("Can't open amisslmaster.library version 4.9 and above"); if ((OOBase=IExec->OpenLibrary("oo.library", 1 ))) { if (LIB_IS_AT_LEAST(OOBase, 1, 13)) { IOO = (struct OOIFace *)IExec->GetInterface( OOBase, "main", 1, NULL ); - if(!IOO) CleanExit("Can't open oo.library Interface"); + if(!IOO) return CleanExit("Can't open oo.library Interface"); } - else CleanExit("Can't open oo.library version 1.13 and above"); - } - else CleanExit("Can't open oo.library version 1.13 and above. Is it installed?"); - - if ((AmiSSLMasterBase = IExec->OpenLibrary("amisslmaster.library", 4 ))) - { - if (!LIB_IS_AT_LEAST(AmiSSLMasterBase, 4, 9)) - CleanExit("Can't open amisslmaster.library version 4.9 and above"); + else return CleanExit("Can't open oo.library version 1.13 and above"); } - else CleanExit("Can't open amisslmaster.library version 4.9 and above"); + else return CleanExit("Can't open oo.library version 1.13 and above. Is it installed?"); //// Classes and Gadgets opening if ((ListBrowserBase = IIntuition->OpenClass( "gadgets/listbrowser.gadget", 1, &ListBrowserClass ))) { IListBrowser = (struct ListBrowserIFace *)IExec->GetInterface( (struct Library *) ListBrowserBase, "main", 1, NULL ); - if(!IListBrowser) CleanExit("Can't open ListBrowser Gadget Interface"); + if(!IListBrowser) return CleanExit("Can't open ListBrowser Gadget Interface"); } - else CleanExit("Can't open ListBrowser"); + else return CleanExit("Can't open ListBrowser"); WindowBase = IIntuition->OpenClass( "window.class", 53, &WindowClass ); - if (!WindowBase) CleanExit("Can't open Window Class"); + if (!WindowBase) return CleanExit("Can't open Window Class"); LayoutBase = IIntuition->OpenClass( "layout.gadget", 53, &LayoutClass ); - if (!LayoutBase) CleanExit("Can't open Layout Gadget"); + if (!LayoutBase) return CleanExit("Can't open Layout Gadget"); LabelBase = IIntuition->OpenClass( "label.image", 53, &LabelClass ); - if (!LabelBase) CleanExit("Can't open Label Image"); + if (!LabelBase) return CleanExit("Can't open Label Image"); ChooserBase = IIntuition->OpenClass( "chooser.gadget", 53, &ChooserClass ); if (!ChooserBase) CleanExit("Can't open Chooser Gadget"); ButtonBase = IIntuition->OpenClass( "button.gadget", 53, &ButtonClass ); - if (!ButtonBase) CleanExit("Can't open Button Gadget"); + if (!ButtonBase) return CleanExit("Can't open Button Gadget"); StringBase = IIntuition->OpenClass( "string.gadget", 53, &StringClass ); - if (!StringBase) CleanExit("Can't open String Gadget"); + if (!StringBase) return CleanExit("Can't open String Gadget"); ScrollerBase = IIntuition->OpenClass( "scroller.gadget", 53, &ScrollerClass ); - if (!ScrollerBase) CleanExit("Can't open Scroller Gadget"); + if (!ScrollerBase) return CleanExit("Can't open Scroller Gadget"); TextEditorBase = IIntuition->OpenClass( "texteditor.gadget", 53, &TextEditorClass ); - if (!TextEditorBase) CleanExit("Can't open TextEditor Gadget"); + if (!TextEditorBase) return CleanExit("Can't open TextEditor Gadget"); BitMapBase = IIntuition->OpenClass( "bitmap.image", 53, &BitMapClass ); - if (!BitMapBase) CleanExit("Can't open BitMap Image"); + if (!BitMapBase) return CleanExit("Can't open BitMap Image"); RequesterBase = IIntuition->OpenClass( "requester.class", 53, &RequesterClass ); - if (!RequesterBase) CleanExit("Can't open Requester Class"); + if (!RequesterBase) return CleanExit("Can't open Requester Class"); + + return RETURN_OK; } diff --git a/src/libshandler.h b/src/libshandler.h index 88ac8f3..555bdab 100644 --- a/src/libshandler.h +++ b/src/libshandler.h @@ -4,6 +4,6 @@ #define _LIBSHANDLER_H int CleanExit(const char *); -void OpenLibs(void); +int OpenLibs(void); #endif diff --git a/src/mainWin.c b/src/mainWin.c index 3ec8e06..74c9653 100755 --- a/src/mainWin.c +++ b/src/mainWin.c @@ -212,10 +212,10 @@ Object *buildMainWindow(struct MsgPort *appPort, Object *winMenu) // END - Left Sidebar LAYOUT_AddChild, gadgets[GID_PAGES] = radioPages, - //LAYOUT_WeightBar, TRUE, + /* + LAYOUT_WeightBar, TRUE, // START - Right Sidebar - /* LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL, LAYOUT_Orientation, LAYOUT_ORIENT_VERT, @@ -233,9 +233,8 @@ Object *buildMainWindow(struct MsgPort *appPort, Object *winMenu) TAG_DONE), CHILD_WeightedWidth, 30, CHILD_MinWidth, 200, - */ // END - Right Sidebar - + */ TAG_DONE), TAG_DONE), TAG_DONE); diff --git a/src/mediavault.c b/src/mediavault.c index c772c92..99b5711 100644 --- a/src/mediavault.c +++ b/src/mediavault.c @@ -9,10 +9,15 @@ void die(const char *s) int main(void) { + int libsOpened; + libsOpened = OpenLibs(); - OpenLibs(); + if (libsOpened) + { + return libsOpened; + } - showGUI(); + showGUI(); //discoverUPnPServers(); //freeUpnpServers(); //getMetadata((char *)"dummy"); diff --git a/src/radiofuncs.c b/src/radiofuncs.c index 2140880..e7fcbf3 100755 --- a/src/radiofuncs.c +++ b/src/radiofuncs.c @@ -23,7 +23,7 @@ #include "httpfuncs.h" #include "stringfuncs.h" -uint8 maxRadioResults = 50; +uint8 maxRadioResults = 20; static CONST_STRPTR radioAPIUrl = "https://de1.api.radio-browser.info/json"; static char url[255]; @@ -44,7 +44,7 @@ STRPTR getRadioStations(struct filters lastFilters, int offset) if (offset > 0) { - char offsetStr[3]; + char offsetStr[5]; IUtility->Strlcat(url, "&offset=", sizeof(url)); IUtility->SNPrintf(offsetStr, sizeof(offsetStr), "%ld", offset * maxRadioResults); IUtility->Strlcat(url, offsetStr, sizeof(url)); @@ -109,17 +109,16 @@ size_t getRadioList(struct List *stationList, STRPTR jsonData, int offset) //char charsetName[128]; jsonRoot = IJansson->json_loads(jsonData, 0, &jsonError); - if(!jsonRoot) { - IDOS->Printf("json error: on line %d: %s\n", jsonError.line, jsonError.text); + //IDOS->Printf("json error: on line %d: %s\n", jsonError.line, jsonError.text); return ~0UL; } if (!json_is_array(jsonRoot)) { IJansson->json_decref(jsonRoot); - IDOS->Printf("JSON error: jsonRoot is not an array"); + //IDOS->Printf("JSON error: jsonRoot is not an array"); return ~0UL; } @@ -131,7 +130,7 @@ size_t getRadioList(struct List *stationList, STRPTR jsonData, int offset) { IExec->NewList(stationList); } - + for(cnt = 0; cnt < IJansson->json_array_size(jsonRoot); cnt++) { struct Node *stationNode; @@ -203,7 +202,6 @@ size_t getRadioList(struct List *stationList, STRPTR jsonData, int offset) //IDOS->Printf("votes: %ld\n", (ULONG)IJansson->json_integer_value(votes)); votesNum = (ULONG)IJansson->json_integer_value(votes); - stationNode = IListBrowser->AllocListBrowserNode( 4, //LBNA_UserData, stationData, LBNA_Column, 0, diff --git a/src/stringfuncs.c b/src/stringfuncs.c index 715c0e7..f41488a 100755 --- a/src/stringfuncs.c +++ b/src/stringfuncs.c @@ -29,33 +29,33 @@ STRPTR charConv(CONST_STRPTR value) iconv_t cd = (iconv_t) -1; char charsetName[128]; STRPTR convertedValue; - + IDOS->GetVar("Charset", charsetName, sizeof(charsetName), GVF_GLOBAL_ONLY); cd = iconv_open(charsetName, "UTF-8"); convertedValue = useIconv(cd, value); - - if (cd != (iconv_t)-1) iconv_close(cd); - - return convertedValue; + + if (cd != (iconv_t)-1) iconv_close(cd); + + return convertedValue; } static STRPTR useIconv(iconv_t cd, CONST_STRPTR string) { - static char buffer[ICONV_BUFFER]; - size_t inleft, outleft = ICONV_BUFFER - 1; - CONST_STRPTR inbuf = string; - STRPTR outbuf = buffer; + static char buffer[ICONV_BUFFER]; + size_t inleft, outleft = ICONV_BUFFER - 1; + CONST_STRPTR inbuf = string; + STRPTR outbuf = buffer; - if (string == NULL) return NULL; + if (string == NULL) return NULL; - inleft = strlen(string); + inleft = strlen(string); - if (cd == (iconv_t)-1) return (STRPTR) string; + if (cd == (iconv_t)-1) return (STRPTR) string; - memset(buffer, 0, ICONV_BUFFER); + memset(buffer, 0, ICONV_BUFFER); - if (iconv(cd, &inbuf, &inleft, &outbuf, &outleft) == (size_t)-1) - return (STRPTR) string; - else - return buffer; + if (iconv(cd, &inbuf, &inleft, &outbuf, &outleft) == (size_t)-1) + return (STRPTR) string; + else + return buffer; } diff --git a/src/upnpfuncs.h b/src/upnpfuncs.h index 0052d3d..c794e45 100755 --- a/src/upnpfuncs.h +++ b/src/upnpfuncs.h @@ -48,6 +48,8 @@ const char DISCOVERMSG[105] = "M-SEARCH * HTTP/1.1\r\n"\ "MAN:\"ssdp:discover\"\r\n"\ "\r\n"; -#include "globals.h" +//#include "globals.h" + +void discoverUPnPServers(void); #endif diff --git a/src/version.h b/src/version.h index deaa56d..f1c0e28 100755 --- a/src/version.h +++ b/src/version.h @@ -28,11 +28,11 @@ #endif #ifndef PATCH -#define PATCH 0 +#define PATCH 1 #endif #ifndef RELEASE_DATE -#define RELEASE_DATE "27.5.2021" +#define RELEASE_DATE "31.5.2021" #endif #define APPNAME "MediaVault"