Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to compile on ubuntu 18.04 #92

Open
ubuntupunk opened this issue Oct 6, 2019 · 3 comments
Open

fails to compile on ubuntu 18.04 #92

ubuntupunk opened this issue Oct 6, 2019 · 3 comments

Comments

@ubuntupunk
Copy link

In file included from main.c:23:0:
./include/util.h:11:19: warning: duplicate ‘const’ declaration specifier [-Wduplicate-decl-specifier]
extern const char const * plain_md5(const char *);
^~~~~
main.c: In function ‘main’:
main.c:250:3: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
dup(null);
^~~~~~~~~
main.c:251:3: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
dup(null);
^~~~~~~~~
main.c:463:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(np, output, strlen(output));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libshellfm.a(play.o): In function output': play.c:(.text+0x156): undefined reference to scale'
play.c:(.text+0x185): undefined reference to `scale'
collect2: error: ld returned 1 exit status
Makefile:45: recipe for target 'shell-fm' failed
make[1]: *** [shell-fm] Error 1
make[1]: Leaving directory '/home/afropunk/Code/Radio/shell-fm/source'
Makefile:12: recipe for target

@SneakyWhoami
Copy link

SneakyWhoami commented Jul 9, 2020

You can overcome the compilation error without editing the code if you have gcc6 installed by compiling with CC=gcc-6 make instead of just make. That way we don't yet need any updates to the project to at least try it out. I am able to run the application and authorize it with lastfm. The next problem I have is a segfault in json_hash:

Shell.FM v0.8, (C) 2006-2012 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).

Press ? for help.

   
Program received signal SIGSEGV, Segmentation fault.
0x000055555555b341 in json_hash ()
(gdb) bt
#0  0x000055555555b341 in json_hash ()
#1  0x000055555555f50e in load_feed ()
#2  0x000055555555cda9 in radioprompt ()
#3  0x0000555555557d37 in main ()

(note this is with both optional libs on on 20.04)

I haven't tried to investigate this yet, and I'll probably just throw a print in there to see what data we're trying to parse (or whatever is going wrong) and fail to fix it. I expect it's some kind of API change since it's a slightly different service to ye olde lastfm.

@SneakyWhoami
Copy link

Ok yup so source/feeds.c around line 102:

        response = rest(method, & h);
        
        if(!response)
                return NULL;

        json = json_parse(response);

The first time it is called, it segfaults because the response it receives is not json. I've attached the XML content of the response.

Now we find out, can we still get a json response, and if so, is it what we're expecting, and if not, how well can we patch this up? :)

response.txt
screenshot 4500

@SneakyWhoami
Copy link

image
The API is ignoring format=json spec when passed with post params. Adding the thing to the GET thing made the thing do the thing.
If you patch this up, (and I'm sure my "fix" is not good) you will find that you get a "BAD REQUEST (400)" error or something on the method radio.tune. That's of course because the radio API is retired. You probably know that they have in fact got a "player" on the site which effectively replaces the old radio API - however, it is not situated in the REST API area thing where you have to get an API token for. Theoretically this could mean that you can't access that as an API and therefore couldn't integrate it into a program like this one. However it is available to web browsers, and roughly reimplements most of the old stations (no neighbours yet, they're working on it) so theoretically as long as you have a "web browser" you're golden.

If you get that working you will need an external player of some kind as that API thing only serves spotify/youtube/whatever links at the moment, not like the Good Old Radio which streamed MP3s right down to your ear holes or whatever

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants