halbgut / rss-o-bot

A FOSS RSS Bot alternative
9 stars 4 forks source link

Windows compatibility? #9

Open ghost opened 7 years ago

ghost commented 7 years ago

Hello, I'm not quite sure but I think your rss-o-bot is only compatible with linux, am I right? If that's the case, do you plan any version I can run using command prompt on Windows? Thanks for your work!

halbgut commented 7 years ago

Sadly I don't have a windows machine to test it on. But I did test it on one at around version 0.8.0 and it worked. If you have the time, it'd be great if you could test it.

ghost commented 7 years ago

Here's a screenshot: https://i.imgur.com/rXOONhE.png

using DEBUG=rss-o-bot does not work :/

halbgut commented 7 years ago

The DEBUG=rss-o-bot sets an environment variable for scope of the command. Can you try setting DEBUG to rss-o-bot or "rss-o-bot" as described here?

ghost commented 7 years ago

The output said that the value has been saved, but where?

I used

setx DEBUG "C:\Users\hiru\AppData\Roaming\npm\rss-o-bot.cmd"
halbgut commented 7 years ago

Oh, the value should be "rss-o-bot". In the code I'm checking if there's an environment variable called DEBUG and its value is rss-o-bot. After you've run setx DEBUG "rss-o-bot". You should be able to run rss-o-bot again and now see debugging information.

ghost commented 7 years ago

immagine

nope :/

halbgut commented 7 years ago

Could you try running the following two lines in order?

setx DEBUG "rss-o-bot"
rss-o-bot version
ghost commented 7 years ago

immagine

in case you need, I installed npm 3.10.9, I'm using Windows 10 x64 Pro

halbgut commented 7 years ago

Alright. I think cmd probably handles environment variables differently somehow. Could you try the following in PowerShell?

set DEBUG "rss-o-bot"
rss-o-bot version
ghost commented 7 years ago

immagine

I misspelled the first command :P

halbgut commented 7 years ago

Cool! Have you added a configuration file yet?

ghost commented 7 years ago

immagine

data folder is outside of ./rss-o-bot/dist/ (yes, config file is inside the data folder) and no config file is stored in my Users folder

halbgut commented 7 years ago

Sorry, I really have to work on that error message. It should appear in non-debug mode and contain some more helpful information... 😅

If you did put a config.json file inside of that directory, RSS-o-Bot should find it. But putting your configuration file there is generally a bad idea, since it will probably be deleted with every rss-o-bot update. So creating a directory C:\Users\hiru\.rss-o-bot and putting the config file there is a better idea. I'll remove the first ./rss-o-bot/data option, since it doesn't make much sense 😅 . I did some roughly looked over the code yesterday and found some Unix paths and fixed them. So this version is probably not going to work for windows, but the next one will 🙃. I'll have a device to test the version on this evening.

Thanks again for taking the time to report the issue and iterate with me! 😄

halbgut commented 7 years ago

Alright, I was able to fix some issues. The latest release (rss-o-bot@1.0.0-rc.15) contains these fixes. Could you try using this version?

ghost commented 7 years ago

immagine

here we go

halbgut commented 7 years ago

Great! Now you'll just need to add a configuration file. Please follow these instructions. I'll write some windows-specific instructions tonight, but basically you just need to know that ~ is C:\Users\hiro in your case.

It looks like you're using rss-o-bot-desktop. I haven't checked it out on windows yet, so it most likely doesn't work. The framework I'm using only supports links in notifications on Mac OS. I'll try to find something better. For now your best bet is probably to use rss-o-bot-email or rss-o-bot-telegram.

ghost commented 7 years ago

I know nothing about how node.js works but maybe this can help you with the Windows notifications feature https://github.com/mikaelbr/node-notifier

I was trying to add filters but there is nothing in the man-page https://github.com/Kriegslustig/rss-o-bot/blob/master/src/man/man.md

halbgut commented 7 years ago

[...] maybe this can help you with the Windows notifications [...]

That's actually the framework I'm currently using :)

I was trying to add filters [...]

It's actually documented here. Please tell me if there's anything unclear. I also added a simple example to the man page.

ghost commented 7 years ago

So.. I'm here again because I have a problem with a URL. It looks like the system does not recognize the url as a feed url because there are parameters at the end of the URL like &term and &user. Example: https://www.nyaa.se/?page=rss&term=Gabriel+DropOut+%5B720p%5D&user=64513

when I try to install rss-o-bot-telegram I have this output:

+-- UNMET PEER DEPENDENCY rss-o-bot@1.0.x `-- rss-o-bot-telegram@1.0.0-rc.0

npm WARN rss-o-bot-telegram@1.0.0-rc.0 requires a peer of rss-o-bot@1.0.x but none was installed.

And I don't know what I have to use in the config file as "telegram-recipient"

halbgut commented 7 years ago

Sorry for the late answer.

It looks like the system does not recognize the url as a feed url because there are parameters at the end of the URL like &term and &user.

Most shells interpret some characters as syntax. & is commonly interpreted as "create a background process from this". To prevent the shell from interpreting these characters you can wrap the string in signle quotes '. So try running this instead:

rss-o-bot add 'https://www.nyaa.se/?page=rss&term=Gabriel+DropOut+%5B720p%5D&user=64513'

when I try to install rss-o-bot-telegram I have this output:

The UNMET PEER DEPENDENCY warning is harmless. It's there because rss-o-bot-telegram@1.0.0-rc.0 doesn't link to the rc version of RSS-o-Bot. So it should still work.

And I don't know what I have to use in the config file as "telegram-recipient"

The telegram-recipients option is documented in the RSS-o-Bot Telegram README. The documentation might be a little rough though 😅 . Please ask if you have questions about it.

ghost commented 7 years ago

The output for rss-o-bot poll-telegram is:

rss-o-bot Error: NO_SUCH_COMMAND rss-o-bot at Object.create (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\dist\lib\shared\errors.js:32:15) rss-o-bot at throwO (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\dist\lib\shared\errors.js:27:27) rss-o-bot at MergeMapSubscriber.project (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\dist\cli.js:213:49) rss-o-bot at MergeMapSubscriber._tryNext (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\mergeMap.js:120:27) rss-o-bot at MergeMapSubscriber._next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\mergeMap.js:110:18) rss-o-bot at MergeMapSubscriber.Subscriber.next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:89:18) rss-o-bot at MapSubscriber._next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\map.js:83:26) rss-o-bot at MapSubscriber.Subscriber.next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:89:18) rss-o-bot at MapSubscriber._next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\map.js:83:26) rss-o-bot at MapSubscriber.Subscriber.next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:89:18) rss-o-bot at SwitchMapSubscriber.notifyNext (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\switchMap.js:124:30) rss-o-bot at InnerSubscriber._next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\InnerSubscriber.js:23:21) rss-o-bot at InnerSubscriber.Subscriber.next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:89:18) rss-o-bot at MapSubscriber._next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\map.js:83:26) rss-o-bot at MapSubscriber.Subscriber.next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:89:18) rss-o-bot at MapSubscriber._next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\map.js:83:26) +0ms error: No such command.

and there is a problem with rss-o-bot test-notification since it looks for the node_modules folder inside of %appdata%\npm\lib instead of %appdata%\npm . I had to make the lib folder inside npm and copy the node_modules inside this folder. Then I tried to test the command and this is the output:

rss-o-bot Running command "test-notification" locally. +0ms rss-o-bot Passing arguments [] +3ms rss-o-bot Passing switches {} +1ms rss-o-bot Notifier not in Error: ENOENT: no such file or directory, stat 'C:\Users\hiru\AppData\Roaming\npm\lib\node_modules\telegram' +988ms rss-o-bot Notifier found in C:\Users\hiru\AppData\Roaming\npm\lib\node_modules\rss-o-bot-telegram +1ms rss-o-bot Successfully loaded notifier: telegram +1s rss-o-bot Notifier not in Error: ENOENT: no such file or directory, stat 'C:\Users\hiru\AppData\Roaming\npm\lib\node_modules\email' +16ms rss-o-bot Notifier not in [object Object] +1ms rss-o-bot Continuing with normal operation without notifier email +0ms Failed to load notifier "email" Successfully sent test notification.(node:8044) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): HTTPError: Response code 400 (Bad Request)

halbgut commented 7 years ago

The output for rss-o-bot poll-telegram is:

Oh damn. This is now rss-o-bot-telegram poll, sorry. I'll update the docs.

since it looks for the node_modules folder inside of %appdata%\npm\lib instead of %appdata%\npm.

Thanks for the info. What version of NPM are you running (run npm --version to get it)? It could be a cross-platform issue. More likely though, this changed from npm@2.x to npm@3.x. But I'll have to add %appdata%\npm\node_modules to the notifier paths anyways. For now though, if you don't want to copy the whole directory, you could instead use the whole path as a notification-method in your .rss-o-bot\config.json:

...
  "notification-methods": [
    "C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot-telegram"
    ...
  ]
...
ghost commented 7 years ago

What version of NPM are you running [...]?

3.10.9

When I enter rss-o-bot-telegram poll I have a long list of null that goes endlessly

I tried deleting the lib folder and using the command again (after editing the config file and using the path instead of the telegram tag) and this is the error output:

C:\Users\hiru>rss-o-bot-telegram poll Error: Failed to parse config file: C:\Users\hiru.rss-o-bot at MapSubscriber.project (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\dist\lib\config.js:64:15) at MapSubscriber._next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\map.js:77:35) at MapSubscriber.Subscriber.next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:89:18) at AsyncSubject.Subject.next (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subject.js:55:25) at AsyncSubject.complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\AsyncSubject.js:41:35) at handlerFn (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\observable\BoundNodeCallbackObservable.js:106:33) at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)

this is my config file

{ "notification-methods": ["C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot-telegram"], "telegram-api-token": "?????????????????????????????????????????????", "telegram-recipients": ["telegram_username"] }

I edited the api-token and the recipient..

halbgut commented 7 years ago

When I enter rss-o-bot-telegram poll I have a long list of null that goes endlessly

Yeah, every null is a request to the telegram API where the telegram bot doesn't have any messages. I improved the CLI. If you update it (npm i -g rss-o-bot-telegram) and run the command again, you should see no output but the command shouldn't exit. Then send a message to your bot. Now you should see a number as the output in the rss-o-bot-telegram poll command. That's your Telegram-recipientId. Now put that where your telegram username now is.

Also make sure you have the latest version of rss-o-bot installed. I made a few pretty important fixes/improvements.

ghost commented 7 years ago

rss-o-bot test-notification rss-o-bot Running command "test-notification" locally. +0ms rss-o-bot Passing arguments [] +3ms rss-o-bot Passing switches {} +2ms rss-o-bot Notifier not in Error: ENOENT: no such file or directory, stat 'C:\Users\hiru\AppData\Roaming\npm\lib\node_modules\telegram' +959ms rss-o-bot Notifier not in [object Object] +1ms rss-o-bot Continuing with normal operation without notifier telegram +0ms Failed to load notifier "telegram" rss-o-bot EmptyError: no elements in sequence rss-o-bot at EmptyError.Error (native) rss-o-bot at new EmptyError (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\util\EmptyError.js:20:26) rss-o-bot at LastSubscriber._complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\last.js:114:31) rss-o-bot at LastSubscriber.Subscriber.complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:114:18) rss-o-bot at SwitchMapSubscriber.Subscriber._complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:132:26) rss-o-bot at SwitchMapSubscriber._complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\switchMap.js:106:40) rss-o-bot at SwitchMapSubscriber.Subscriber.complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:114:18) rss-o-bot at DoSubscriber._complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\do.js:108:30) rss-o-bot at DoSubscriber.Subscriber.complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:114:18) rss-o-bot at MapSubscriber.Subscriber._complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:132:26) rss-o-bot at MapSubscriber.Subscriber.complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:114:18) rss-o-bot at FilterSubscriber.Subscriber._complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:132:26) rss-o-bot at FilterSubscriber.Subscriber.complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:114:18) rss-o-bot at DefaultIfEmptySubscriber._complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\defaultIfEmpty.js:73:26) rss-o-bot at DefaultIfEmptySubscriber.Subscriber.complete (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\Subscriber.js:114:18) rss-o-bot at OnErrorResumeNextSubscriber.subscribeToNextSource (C:\Users\hiru\AppData\Roaming\npm\node_modules\rss-o-bot\node_modules\rxjs\operator\onErrorResumeNext.js:71:30) +1ms error: An unknown error occured. Run the command again with the DEBUG=rss-o-bot infront to get some more info.

It looks like it is looking for a telegram folder inside node_modules

halbgut commented 7 years ago

Alright, and this is running rss-o-bot@1.0.0-rc.22 and using the config file you posted in the last comment?

ghost commented 7 years ago

this is the config file

{ "notification-methods": ["telegram"], "telegram-api-token": "api-token", "telegram-recipients": ["recipient"] }

I switched to "telegram" because I made a junction inside the lib folder so I do not have to copy the whole folder but just make a symbolic link inside the lib folder that goes into node_modules

halbgut commented 7 years ago

Just to be sure, what's the output of rss-o-bot -v?

ghost commented 7 years ago

C:\Users\hiru>rss-o-bot -v rss-o-bot Running command "-v" locally. +0ms rss-o-bot Passing arguments [] +3ms rss-o-bot Passing switches {} +1ms RSS-o-Bot Version: 1.0.0-rc.22