[mythtv-commits] Ticket #4517: sorting in upnp

MythTV mythtv at cvs.mythtv.org
Wed Sep 3 11:02:17 UTC 2008


#4517: sorting in upnp
----------------------------+-----------------------------------------------
 Reporter:  Kevin Kalmbach  |        Owner:  greg    
     Type:  patch           |       Status:  assigned
 Priority:  minor           |    Milestone:  unknown 
Component:  upnp            |      Version:  head    
 Severity:  medium          |   Resolution:          
  Mlocked:  0               |  
----------------------------+-----------------------------------------------
Description changed by nigel:

Old description:

> I already put this in the mailing list, but this might be a better forum.
>

> I noticed that in the latest incarnation of upnp stuff, the names are not
> sorted.
> I put in a quick sorting, don't know if it's the correct way or worthy of
> committing, but I thought I would throw it out there.
> If basically adds a sortColumn to the UPnpCDSRootInfo, then  adds that in
> the select.
>
> Thanks
> -Kevin
>
> --- upnpcds.cpp 2008-01-19 17:13:47.000000000 -0700
> +++ ../upnpcds.cpp      2008-01-19 18:46:54.000000000 -0700
> @@ -1210,7 +1210,6 @@
>      if (query.isConnected())
>      {
>          QString sWhere( "" );
> -        QString sOrder( "" );
>
>          if ( sKey.length() > 0)
>          {
> @@ -1218,13 +1217,6 @@
>                         .arg( pInfo->column );
>          }
>
> -
> -        QString orderColumn( pInfo->orderColumn );
> -        if (orderColumn.length() != 0) {
> -            sOrder = QString( "ORDER BY %1 " )
> -                       .arg( orderColumn );
> -        }
> -
>          if (pRequest->m_sObjectId.startsWith("Videos", true))
>         {
>              if (pRequest->m_sParentId != "")
> @@ -1263,7 +1255,7 @@
>
>          QString sSQL = QString( "%1 %2 LIMIT %3, %4" )
>                            .arg( GetItemListSQL( pInfo->column )  )
> -                          .arg( sWhere + ParentClause + sOrder )
> +                          .arg( sWhere + ParentClause )
>                            .arg( pRequest->m_nStartingIndex  )
>                            .arg( pRequest->m_nRequestedCount );
>
> --- upnpcds.h   2008-01-18 16:54:15.000000000 -0700
> +++ ../upnpcds.h        2008-01-19 18:46:54.000000000 -0700
> @@ -111,7 +111,6 @@
>      char *column;
>      char *sql;
>      char *where;
> -    char *orderColumn;
>
>  } UPnpCDSRootInfo;
>

>
> --- upnpcdsmusic.cpp    2008-01-18 16:57:19.000000000 -0700
> +++ ../upnpcdsmusic.cpp 2008-01-19 18:46:54.000000000 -0700
> @@ -50,7 +50,7 @@
>              "FROM music_songs song "
>              "%1 "
>              "ORDER BY name",
> -        "", "" },
> +        "" },
>
>  /*
>  This is currently broken... need to handle list of items with single
> parent
> (like 'All Music')
> @@ -74,7 +74,7 @@
>              "%1 "
>              "GROUP BY a.album_id "
>              "ORDER BY a.album_name",
> -        "WHERE song.album_id=:KEY","" },
> +        "WHERE song.album_id=:KEY" },
>  /*
>
>      {   "By Artist",
> --- upnpcdstv.cpp       2008-01-18 16:58:54.000000000 -0700
> +++ ../upnpcdstv.cpp    2008-01-19 18:46:54.000000000 -0700
> @@ -44,7 +44,7 @@
>              "FROM recorded "
>              "%1 "
>              "ORDER BY starttime DESC",
> -        "", "" },
> +        "" },
>
>      {   "By Title",
>          "title",
> @@ -55,7 +55,7 @@
>              "%1 "
>              "GROUP BY title "
>              "ORDER BY title",
> -        "WHERE title=:KEY", "" },
> +        "WHERE title=:KEY" },
>
>      {   "By Genre",
>          "category",
> @@ -66,7 +66,7 @@
>              "%1 "
>              "GROUP BY category "
>              "ORDER BY category",
> -        "WHERE category=:KEY", "" },
> +        "WHERE category=:KEY" },
>
>      {   "By Date",
>          "DATE_FORMAT(starttime, '%Y-%m-%d')",
> @@ -77,7 +77,7 @@
>              "%1 "
>              "GROUP BY name "
>              "ORDER BY starttime DESC",
> -        "WHERE DATE_FORMAT(starttime, '%Y-%m-%d') =:KEY", "" },
> +        "WHERE DATE_FORMAT(starttime, '%Y-%m-%d') =:KEY" },
>
>      {   "By Channel",
>          "chanid",
> @@ -89,7 +89,7 @@
>              "%1 "
>              "GROUP BY name "
>              "ORDER BY channel.chanid",
> -        "WHERE channel.chanid=:KEY", "" },
> +        "WHERE channel.chanid=:KEY" },
>

>      {   "By Group",
> @@ -100,7 +100,7 @@
>              "%1 "
>              "GROUP BY recgroup "
>              "ORDER BY recgroup",
> -        "WHERE recgroup=:KEY", "" }
> +        "WHERE recgroup=:KEY" }
>  };
>
>  int UPnpCDSTv::g_nRootCount = sizeof( g_RootNodes ) / sizeof(
> UPnpCDSRootInfo );
> --- upnpcdsvideo.cpp    2008-01-18 16:57:50.000000000 -0700
> +++ ../upnpcdsvideo.cpp 2008-01-19 18:46:54.000000000 -0700
> @@ -22,8 +22,8 @@
>            "1 as children "
>              "FROM upnpmedia "
>              "%1 "
> -            "ORDER BY title ASC",
> -        "", "title" }
> +            "ORDER BY title DESC",
> +        "" }
>
>  };

New description:

 I already put this in the mailing list, but this might be a better forum.


 I noticed that in the latest incarnation of upnp stuff, the names are not
 sorted.
 I put in a quick sorting, don't know if it's the correct way or worthy of
 committing, but I thought I would throw it out there.
 If basically adds a sortColumn to the UPnpCDSRootInfo, then  adds that in
 the select.

 Thanks
 -Kevin
 {{{
 --- upnpcds.cpp 2008-01-19 17:13:47.000000000 -0700
 +++ ../upnpcds.cpp      2008-01-19 18:46:54.000000000 -0700
 @@ -1210,7 +1210,6 @@
      if (query.isConnected())
      {
          QString sWhere( "" );
 -        QString sOrder( "" );

          if ( sKey.length() > 0)
          {
 @@ -1218,13 +1217,6 @@
                         .arg( pInfo->column );
          }

 -
 -        QString orderColumn( pInfo->orderColumn );
 -        if (orderColumn.length() != 0) {
 -            sOrder = QString( "ORDER BY %1 " )
 -                       .arg( orderColumn );
 -        }
 -
          if (pRequest->m_sObjectId.startsWith("Videos", true))
         {
              if (pRequest->m_sParentId != "")
 @@ -1263,7 +1255,7 @@

          QString sSQL = QString( "%1 %2 LIMIT %3, %4" )
                            .arg( GetItemListSQL( pInfo->column )  )
 -                          .arg( sWhere + ParentClause + sOrder )
 +                          .arg( sWhere + ParentClause )
                            .arg( pRequest->m_nStartingIndex  )
                            .arg( pRequest->m_nRequestedCount );

 --- upnpcds.h   2008-01-18 16:54:15.000000000 -0700
 +++ ../upnpcds.h        2008-01-19 18:46:54.000000000 -0700
 @@ -111,7 +111,6 @@
      char *column;
      char *sql;
      char *where;
 -    char *orderColumn;

  } UPnpCDSRootInfo;



 --- upnpcdsmusic.cpp    2008-01-18 16:57:19.000000000 -0700
 +++ ../upnpcdsmusic.cpp 2008-01-19 18:46:54.000000000 -0700
 @@ -50,7 +50,7 @@
              "FROM music_songs song "
              "%1 "
              "ORDER BY name",
 -        "", "" },
 +        "" },

  /*
  This is currently broken... need to handle list of items with single
 parent
 (like 'All Music')
 @@ -74,7 +74,7 @@
              "%1 "
              "GROUP BY a.album_id "
              "ORDER BY a.album_name",
 -        "WHERE song.album_id=:KEY","" },
 +        "WHERE song.album_id=:KEY" },
  /*

      {   "By Artist",
 --- upnpcdstv.cpp       2008-01-18 16:58:54.000000000 -0700
 +++ ../upnpcdstv.cpp    2008-01-19 18:46:54.000000000 -0700
 @@ -44,7 +44,7 @@
              "FROM recorded "
              "%1 "
              "ORDER BY starttime DESC",
 -        "", "" },
 +        "" },

      {   "By Title",
          "title",
 @@ -55,7 +55,7 @@
              "%1 "
              "GROUP BY title "
              "ORDER BY title",
 -        "WHERE title=:KEY", "" },
 +        "WHERE title=:KEY" },

      {   "By Genre",
          "category",
 @@ -66,7 +66,7 @@
              "%1 "
              "GROUP BY category "
              "ORDER BY category",
 -        "WHERE category=:KEY", "" },
 +        "WHERE category=:KEY" },

      {   "By Date",
          "DATE_FORMAT(starttime, '%Y-%m-%d')",
 @@ -77,7 +77,7 @@
              "%1 "
              "GROUP BY name "
              "ORDER BY starttime DESC",
 -        "WHERE DATE_FORMAT(starttime, '%Y-%m-%d') =:KEY", "" },
 +        "WHERE DATE_FORMAT(starttime, '%Y-%m-%d') =:KEY" },

      {   "By Channel",
          "chanid",
 @@ -89,7 +89,7 @@
              "%1 "
              "GROUP BY name "
              "ORDER BY channel.chanid",
 -        "WHERE channel.chanid=:KEY", "" },
 +        "WHERE channel.chanid=:KEY" },


      {   "By Group",
 @@ -100,7 +100,7 @@
              "%1 "
              "GROUP BY recgroup "
              "ORDER BY recgroup",
 -        "WHERE recgroup=:KEY", "" }
 +        "WHERE recgroup=:KEY" }
  };

  int UPnpCDSTv::g_nRootCount = sizeof( g_RootNodes ) / sizeof(
 UPnpCDSRootInfo );
 --- upnpcdsvideo.cpp    2008-01-18 16:57:50.000000000 -0700
 +++ ../upnpcdsvideo.cpp 2008-01-19 18:46:54.000000000 -0700
 @@ -22,8 +22,8 @@
            "1 as children "
              "FROM upnpmedia "
              "%1 "
 -            "ORDER BY title ASC",
 -        "", "title" }
 +            "ORDER BY title DESC",
 +        "" }

  };
 }}}

--

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/4517#comment:2>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list