Ability to Just Show Year for Release Date?
-
These commands should shorten the release date in the gamelist.xml to the first four letters. But as always, make a backup of the file before modifying it!
xmlstarlet ed -u '//releasedate' -x 'substring(.,1,4)' gamelist.xml | less # code by user Marc_BlackJack_Rintsch of ubuntuuers.de released under CC BY-NC-SA 2.0 DE
This won't modify the gamelist.xml, but just shows the modification in the text viewer
less
which you can search by typing/releasedate
(enter) to highlight all <releasedate> tags for easier checking.q
quits back to the command line.If anything seems to be in order, this command will finally modify the gamelist.xml:
xmlstarlet ed --inplace -u '//releasedate' -x 'substring(.,1,4)' gamelist.xml
If
xmlstarlet
isn't installed, this command will do that:sudo apt install xmlstarlet
Although usually seen as suboptimal for editing xml files (instead of using a proper xml editor like
xmlstarlet
), the same can be done with the usually pre-installed text editorsed
. Again, first only checking withless
:sed -r "s/(<releasedate>.{4}).*(<\/releasedate>)/\1\2/" gamelist.xml | less # code by user user_unknown of ubuntuuers.de released under CC BY-NC-SA 2.0 DE
And then modifying the actual file:
sed -i.backup -r "s/(<releasedate>.{4}).*(<\/releasedate>)/\1\2/" gamelist.xml
This will also save the prior state of the file in a copy with the extension ".backup".
In the case that you wonder about the CC notes under the commands, I got them from the german Linux forum.ubuntuusers.de which puts all of its posts under the german version of the Creative Commons license Attribution-NonCommercial-ShareAlike 2.0 Generic (CC BY-NC-SA 2.0).
-
It's an old topic but for info it's also possible in WebtroPie, clicking on the column also sorts by that column
-
@mitu I tried this today, and even though my gamelist.xml has:
<releasedate>1999</releasedate>
instead of the standard:
<releasedate>19990101T000000</releasedate>
it still displays in ES as 01/01/1999, not 1999.
-
A solution would be to enable
<alignment>
for the<datetime>
element. Then we could (at least in a theme) do something link this:<datetime name="md_releasedate"> <alignment>right</alignment> <size>0.4 0.08</size> </datetime>
If the width is set properly then, it will cut of the month/day in front of the year. If no month/day is available for whatever reason, it won't mess up the design because the text is aligned to the right.
Maybe @jdrassa can tell us if adding this would be possible. And while I'm at it, I would also love to see<origin>
added to<datetime>
as well. -
@EctoOne that is a brilliant idea with the 'alignment' ...thumbs up
-
I just tried to add
alignment
to thedatetime
element, but sadly it doesn't work without bigger changes (which I can't do).
The size of the element is determined by the content, so it won't cut off the date like other text elements do.
On the other hand, I submitted a pull request to finally add<origin>
support to thedatetime
element. Something that I was missing for a long time. -
@ectoone your PR motivated me to finally implement a revamped datetime component.
With this change datetime will now support all of the same options as text. In addition there will be 2 additional options
displayRelative
andformat
.displayRelative
lets you choose between rendering the data vs. a relative string (ex: 5 days ago).format
will allow for specifying the format of the date time (ex:<format>%Y</format>
would render just the year). I will be submitting it in the next couple of days, but wanted to post here and get some feedback.Branch:
https://github.com/jrassa/EmulationStation/tree/date-timeDocs:
https://github.com/jrassa/EmulationStation/blob/date-time/THEMES.md#datetimeWindows build:
https://ci.appveyor.com/project/jrassa/emulationstation/builds/19485339/job/01krqi9flrxtbw93/artifacts -
@jdrassa Awesome. I was trying to add some more changes but I still don't understand how to use github and compile stuff. It seems that the test script from @meleu is outdated because whenever I build something with it, I got errors when I tried to run the version.
I then changed the original script to install ES from my fork but then I ended up with a bunch of commits which I wasn't able to figure out how to squash into one. Running RetroPie in a VM and doing the coding on my laptop wasn't a great idea too.I will check out your build ASAP.
Edit:
Looks good to me. One thing that doesn't worked and broke the theme was using the<text>
tag, which Is in your doc but the debug window says unsupported. I can't see any use for it anyways so you just have to remove it from the docs I guess.I also have only tested it with
md_releasedate
and notmd_lastplayed
because I have my gamelists locked, so I don't have that info. -
I also wanted to just show the release year (without the month and day).
This is the first thread that comes up by searching on google.
I solved it:
Add<format>%Y</format>
to the datetime element in the theme you are using.
For example, mine is looking like this:
<datetime name="md_releasedate"> <format>%Y</format> <pos>X.xxxxxxx X.xxxxxxxx</pos>
-
@foxtochop
Excellent ! just tried it and it does indeed work .. Thanks very much :) -
@jdrassa As far as my research goes with the github documentation and this thread, datetime can only be displayed in integers. Are there any workarounds to make us able to display a month to its string representation? Any leads and help are much appreciated.
-
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.