RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Ability to Just Show Year for Release Date?

    Scheduled Pinned Locked Moved Projects and Themes
    themesretropie theme
    15 Posts 12 Posters 5.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ClydeC
      Clyde
      last edited by Clyde

      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 editor sed. Again, first only checking with less:

      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).

      1 Reply Last reply Reply Quote 0
      • K
        kixut
        last edited by

        It's an old topic but for info it's also possible in WebtroPie, clicking on the column also sorts by that column 0_1523904962846_year.png

        1 Reply Last reply Reply Quote 0
        • S
          sub_atomic @mitu
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • E
            EctoOne
            last edited by EctoOne

            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.

            1 Reply Last reply Reply Quote 0
            • paffleyP
              paffley
              last edited by

              @EctoOne that is a brilliant idea with the 'alignment' ...thumbs up

              1 Reply Last reply Reply Quote 0
              • E
                EctoOne
                last edited by

                I just tried to add alignment to the datetime 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 the datetime element. Something that I was missing for a long time.

                J 1 Reply Last reply Reply Quote 0
                • J
                  jdrassa @EctoOne
                  last edited by

                  @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 and format. 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-time

                  Docs:
                  https://github.com/jrassa/EmulationStation/blob/date-time/THEMES.md#datetime

                  Windows build:
                  https://ci.appveyor.com/project/jrassa/emulationstation/builds/19485339/job/01krqi9flrxtbw93/artifacts

                  Get latest build of EmulationStation for Windows here

                  E J 2 Replies Last reply Reply Quote 4
                  • E
                    EctoOne @jdrassa
                    last edited by EctoOne

                    @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 not md_lastplayed because I have my gamelists locked, so I don't have that info.

                    1 Reply Last reply Reply Quote 0
                    • foxtochopF
                      foxtochop
                      last edited by

                      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>
                      
                      DreamcastKidD 1 Reply Last reply Reply Quote 3
                      • DreamcastKidD
                        DreamcastKid Banned @foxtochop
                        last edited by

                        @foxtochop
                        Excellent ! just tried it and it does indeed work .. Thanks very much :)

                        1 Reply Last reply Reply Quote 0
                        • J
                          jakong008 @jdrassa
                          last edited by

                          @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.

                          1 Reply Last reply Reply Quote 0
                          • J jakong008 referenced this topic on
                          • First post
                            Last post

                          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.