You are not logged in.

#51 2014-06-28 02:56:16

karol
Archivist
Registered: 2009-05-06
Posts: 25,438

Re: shaman - A small C program to fetch weather

$XDG_CONFIG_HOME/shaman/ got created automatically

drw-r--r-- 2 4.0K Jun 28 01:35 shaman

but I had to create $HOME/.shaman myself.

$ cd /home/karol/.config/shaman/
bash: cd: shaman/: Permission denied

I had to 'chmod +x' and copy cache.json to $XDG_CONFIG_HOME/shaman/ . Now

shaman -m -l "<city>,PL"

alone works.


Edit: Issue opened: https://github.com/HalosGhost/shaman/issues/15

Last edited by karol (2014-06-28 03:04:02)

Offline

#52 2014-06-28 03:10:15

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

karol wrote:

I believe I may have discovered the issue and fixed it; the tentative fix has been pushed. Please rebuild and give it a shot following what I recommend on the Issue tracker.

All the best,

-HG

Last edited by HalosGhost (2014-06-28 03:10:42)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#53 2014-06-28 03:16:54

karol
Archivist
Registered: 2009-05-06
Posts: 25,438

Re: shaman - A small C program to fetch weather

It works, thank you.
Should I post a comment in github and click the 'Close and comment' button?

Offline

#54 2014-06-28 03:19:37

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

karol wrote:

It works, thank you.

Of course! Glad to know that there are people who find this useful! big_smile

Should I post a comment in github and click the 'Close and comment' button?

Feel free to.

Side note: This is why I need to update the test suite and add tests for shaman. Hallmark of pre-alpha quality software (:D)!

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#55 2014-06-28 10:54:09

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 16,099
Website

Re: shaman - A small C program to fetch weather

I think there's a typo in your PKGBUILD.  The prepare function should be the build function.

Offline

#56 2014-06-28 13:50:39

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

Trilby wrote:

I think there's a typo in your PKGBUILD.  The prepare function should be the build function.

Well, part of it certainly should be. I will update this momentarily.

Edit: fixed.

All the best,

-HG

Last edited by HalosGhost (2014-06-28 14:17:26)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#57 2014-06-30 02:40:46

mhogomchungu
Member
Registered: 2013-03-29
Posts: 86

Re: shaman - A small C program to fetch weather

boring sunday so i decided to create a Qt tray application front end for this project.

The project is named "shaman-qt" and its hosted at github[1]

Three builds are available,Qt4 build(default),Qt5 build or KDE4 build.

Currently there is no GUI window to change settings so if you try it,run it once and then open "~/.config/shaman-qt/shaman-qt.conf"
and change the "command" option field to suit your need.

The "\\011" character sequence is used as a separater since shaman has no standard way you represent a separator.

ps:
i am currently not on an arch linux system so i cant test if it builds here or not but it should.

A screenshot of a KDE4 build is here[2]

[1] https://github.com/mhogomchungu/shaman-qt

[2] http://i61.tinypic.com/4socqs.jpg

Last edited by mhogomchungu (2014-06-30 02:45:11)

Offline

#58 2014-06-30 02:46:53

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

Hey there mhogomchungu! Nice work on the status tray utility! I looked through your code quickly, and, though I didn't take a great deal of time to fully understand what you wrote, I seem to be missing how you actually grab the information. Are you forking off a `shaman` process or are you linking to libweather and calling the relevant library commands? (Just out of interest.)

Edit: it looks like you're forking off a `shaman` process. Though it is your prerogative (as it's your project), I chose to set it up with a library backend partly because it would make other project's use of the tool simpler (without the need to fork off a process for the CLi tool).

All the best,

-HG

Last edited by HalosGhost (2014-06-30 02:50:38)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#59 2014-06-30 03:01:23

mhogomchungu
Member
Registered: 2013-03-29
Posts: 86

Re: shaman - A small C program to fetch weather

bug report:

The "--metric" options does not seem to work.

Offline

#60 2014-06-30 03:04:03

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

mhogomchungu wrote:

bug report:

The "--metric" options does not seem to work.

Actually, the --metric option works just fine. I bet I know what the bug you're experiencing is though. For the moment, if your cache is in one unit type, changing the requested unit type will not force the cache to refresh.

Though there isn't a bug for this yet reported on the GitHub tracker, I am (clearly) aware of it. However, since OWM does not provide any data in the JSON API about which scale was requested, I'm having a difficult time figuring out how I should fix it.

I'm considering having two cache files (one in metric and one in imperial); this would be pretty simple to implement, and should fix the issue, but it would mean that shaman would cache twice the amount of data. I'm happy to hear proposed alternatives.

All the best,

-HG

Last edited by HalosGhost (2014-06-30 03:08:04)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#61 2014-06-30 03:39:49

mhogomchungu
Member
Registered: 2013-03-29
Posts: 86

Re: shaman - A small C program to fetch weather

"weather.h" is too generic. You will end up overriding somebody else's header file or somebody else will end up overriding yours.

WIth such a generic header file, i think its best if you install it at "$INSTALL_PREFIX/include/shaman/".This way,somebody who want to use it
will include it with something like:

#include <shaman/weather.h>

The above is pretty clear whose weather header file is being included.

Having a dependency on the library would be ideal. I glanced at it but it did not look like its for third party users.

If the library is also meant to be used by third parties,then you should remove all those json stuff someplace else as they just add noise
as they are not relevant to library users.Keep your internal API separate from your external API.

you should also wrap the API around "extern "C"" to make it usable to C++ users "out of the box".

your header file is also not self sufficient as it lacks a header that has information for "size_t"

you should also add ".pc" file for your library so that build systems will be able to easily pick up your library.

Last edited by mhogomchungu (2014-06-30 03:46:41)

Offline

#62 2014-06-30 03:55:41

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

mhogomchungu wrote:

"weather.h" is too generic. You will end up overriding somebody else's header file or somebody else will end up overriding yours.

WIth such a generic header file, i think its best if you install it at "$INSTALL_PREFIX/include/shaman/".This way,somebody who want to use it
will include it with something like:

#include <shaman/weather.h>

I will consider this. I didn't do it right away because, so far as I know, no one has made something like this.

Having a dependency on the library would be ideal. I glanced at it but it did not look like its for third party users.

The only draw-back of this, of course, is that `shaman` handles caching in a (fairly) sensible manner already (obviously, it's still being worked upon). If you were to link to the library rather than forking off, you would need to figure out caching yourself (though the library functions offer a simple caching interface.

If the library is also meant to be used by third parties,then you should remove all those json stuff someplace else as they just add noise as they are not relevant to library users. Keep your internal API separate from your external API.

I can understand the desire for such a separation, and it is already partially planned (though I will need to consider just how to do this in the best manner).

you should also wrap the API around "extern "C"" to make it usable to C++ users "out of the box".

I am unaware of what you mean by this (I have no experience with C++); but I will look into it.

your header file is also not self sufficient as it lacks a header that has information for "size_t"

I had not considered that, but I will add stddef.h to the header soon enough.

you should also add ".pc" file for your library so that build systems will be able to easily pick up your library.

This is also planned, though it is not a top priority since I would rather get the library to a more stable state before I make it fully exposed.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#63 2014-06-30 06:41:14

mhogomchungu
Member
Registered: 2013-03-29
Posts: 86

Re: shaman - A small C program to fetch weather

HalosGhost wrote:

I'm considering having two cache files (one in metric and one in imperial); this would be pretty simple to implement, and should fix the issue, but it would mean that shaman would cache twice the amount of data. I'm happy to hear proposed alternatives.

All the best,

-HG

You could store a setting in the project's configuration folder that keep track of the unit in use and then force update every time the unit is changed and then store the new unit.

The setting could be a simple as a text file with "1" to mean one unit and "0" to mean another.

You could also have the json file named one way if the unit is in one way and named another way if the unit is in another way.This way,you force update everytime the user's unit does not match the json file name.The new json file will then have a name that matches the new unit.

Offline

#64 2014-06-30 06:43:43

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

mhogomchungu wrote:

You could also have the json file named one way if the unit is in one way and named another way if the unit is in another way.This way,you force update everytime the user's unit does not match the json file name.The new json file will then have a name that matches the new unit.

That's what I mentioned earlier. I could have the cache named "metric.json" or "imperial.json", and do the check from there. It wouldn't be hard to do, so I may go with that unless someone comes up with something better and simpler. The simplest, of course, would just be for OWM to actually supply that information in-response, but I don't know that such will happen.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#65 2014-07-07 19:50:49

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

Okay. I have, for the moment, decided to implement the separation between metric and imperial caching using the method I outlined in my last post. (A separate cache file will be kept for each scale, fetched when requested.)

This should make dealing with separate scales much simpler.

Second, mhogomchungu, I have preliminarily started work on covering up the json internals in the library to make it more developer friendly. This implementation arrives in the form of a new library function owm_easy(). All it really does is take all the information needed, and then runs the other library functions as needed. This should make linking to the library and using it rather than forking off a shaman subprocess much simpler.

We're now coming up on a few implementational questions that I need to attend to (which should not significantly change the user experience); but, once they are finished, shaman (and libweather) will officially be in-beta—meaning that average users should feel comfortable using this for every-day needs.

Accompanying the move to beta will also include documentation for strfweather, weather.h and libweather.

All the best,

-HG

Last edited by HalosGhost (2014-07-07 19:51:40)


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#66 2014-07-10 23:51:06

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 16,099
Website

Re: shaman - A small C program to fetch weather

I figured I'd comment here rather than on the "oh nice" thread.  The tup build is using the flags specified in the .tup file (the ones you listed in the other thread), but it is not inheriting flags specified in makepkg.conf - unless you have removed all the defaults from makepkg.conf, then it would seem it is not inheriting them for you either.

Offline

#67 2014-07-10 23:52:34

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

Trilby wrote:

I figured I'd comment here rather than on the "oh nice" thread.  The tup build is using the flags specified in the .tup file (the ones you listed in the other thread), but it is not inheriting flags specified in makepkg.conf - unless you have removed all the defaults from makepkg.conf, then it would seem it is not inheriting them for you either.

Ahh, I see what you mean. Yes, that's likely because I haven't exported them. I will look into doing so.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#68 2014-07-10 23:54:09

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 16,099
Website

Re: shaman - A small C program to fetch weather

You shouldn't have to export them.  Makepkg does that.  Tup is not picking them up from the environment.

EDIT: I just tested an explicit "export CFLAGS" in the PKGBUILD, and as expected, it didn't have any effect.

Last edited by Trilby (2014-07-10 23:55:52)

Offline

#69 2014-07-10 23:55:56

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

Trilby wrote:

You shouldn't have to export them.  Makepkg does that.  Tup is not picking them up from the environment.

No, that's actually what I meant. Tup's syntax for making environment variables available to the build is the term "export". E.g.,:

export CFLAGS
export LDFLAGS

The above should probably fix the issue when placed in the Tuprules.tup file, but it is untested.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#70 2014-07-10 23:57:34

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 16,099
Website

Re: shaman - A small C program to fetch weather

Odd, I just tried that too, no luck.

Offline

#71 2014-07-10 23:58:14

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

Trilby wrote:

Odd, I just tried that too, no luck.

Fair enough, as I said, I will take a look and see if I can't fix it.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#72 2014-07-26 03:44:53

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

Okay, so I figured out what the issue is. Tup doesn't yet support bringing in environment variables to the build (it's goal is actually to create a deterministic build environment). The `export` command is used to make environment variables (defined inside the tupfile) available to scripts run from the tupfile. However, official support for the opposite (bringing in environment variables for `tup` into the build environment) is planned!

So, once support is added, CFLAGS, LDFLAGS and CC will all be exportable by the environment!

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#73 2014-11-17 21:44:07

axs
Member
Registered: 2009-01-23
Posts: 67
Website

Re: shaman - A small C program to fetch weather

Cool, it works.

I'd suggest sticking with %.0f for temperature and wind. Right now it shows -1.511°C for me, that's a bit too precise for a weather report.
Also, why not link weather.o statically? It's not like there's anything else to use it as a library.

Offline

#74 2014-11-17 22:16:15

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,488
Website

Re: shaman - A small C program to fetch weather

First, I'm glad it works for you! Second, hopefully I will be able to get around to updating shaman a fair bit soon here. One of the things that has been requested is the ability to specify the precision on various numeric fields (this is in the works), not sure what the default would be. I guess 0 probably.

Finally, I'm definitely going to leave libweather as a .so. The notion is that, if someone wanted, they could link to my library without significant difficulty (e.g., for creating a graphical interface or widget).

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Offline

#75 2015-02-23 16:39:55

cameo
Member
Registered: 2012-08-18
Posts: 54

Re: shaman - A small C program to fetch weather

Shaman seems to be exactly what I've been looking for, so I just installed it from the AUR, and also read the manpage.

But I still must be missing something, I just can't get it to work~ No matter what locations or examples I choose, it always says:

$ shaman -l="Los Gatos, CA"
The specified cache path does not exist

Or, if I want refreshing the cache via option -r, shaman just displays the help list.

And that's true, my ~/.shaman/ folder is empty. And even after running updatedb, there's no .json file at all provided by the program (except "test.json" in the source folders). Must I download these from somewhere first?

Last edited by cameo (2015-02-23 17:22:15)

Offline

Board footer

Powered by FluxBB